Branch IO sends an empty response to init

sometimes Branch returns empty json from the server to init. This is a very random case, and the answer to one answer may be empty.

Branch branch = Branch.getInstance(); branch.initSession(new Branch.BranchReferralInitListener() { @Override public void onInitFinished(final JSONObject referringParams, final BranchError error) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { runningOnUIThread(referringParams, error); } }); Log.d("BRANCH IO",referringParams.toString()); } }, a.getIntent().getData(), a); 

referringParams: may be {} or fix data. Any idea why this might happen?

+4
source share
1 answer

Development environment:

Turn TestMode to true to simulate new installations in a developer environment.

 <meta-data android:name="io.branch.sdk.TestMode" android:value="true" /> 


Set up your iOS / Android app

Android: https://docs.branch.io/pages/apps/android/
IOS: https://docs.branch.io/pages/apps/ios/

optional:
- Make sure that you have configured the io-link branching parameters in the console correctly.

enter image description here

- Get your parameters with the correct key name that you defined in your list of parameters in link management.

 JSONObject sessionParams = Branch.getInstance().getLatestReferringParams(); sessionParams.has("paramName") 


Start a branch session:

  Branch branch = Branch.getInstance(); // Branch init branch.initSession(new Branch.BranchReferralInitListener() { @Override public void onInitFinished(JSONObject referringParams, BranchError error) { if (error == null) { Log.e("BRANCH SDK", referringParams.toString()); // latest JSONObject sessionParams = Branch.getInstance().getLatestReferringParams(); Log.e("sessions params :", sessionParams.toString()); // first JSONObject installParams = Branch.getInstance().getFirstReferringParams(); Log.e("install params :", installParams.toString()); processDeepLinkParams(sessionParams); if (getIntent().getExtras() != null && getIntent().getExtras().keySet() != null) { deepLinkinData = getIntent().getExtras().getString("branch_data"); } // Branch logging for debugging // Branch.enableLogging(); } else { Log.i("BRANCH SDK", error.getMessage()); } } }, this.getIntent().getData(), this); 
+1
source

All Articles