This question is not a duplication of this question.I have tried the solution mentioned there but didn't get any luck.
I have added branch.io deep-linking to my app. To test the implementation I have created a link with parameter as described here
https://docs.branch.io/pages/apps/android/#test-deep-link
everything worked fine, but the problem is I can not access the added data from the json object as the json doesn't contain the key I added earlier. I was supposed to get a response like this:
{
"identity_id": "427469360685348303",
"link": "https://example.app.link?%24identity_id=427469360685348303",
"session_id": "429691081177874743",
"data": {
"$canonical_identifier": "item/1503684554354.28",
"$desktop_url": "http://example.com/home",
"$exp_date": 0,
"$identity_id": "427469360685348303",
"$og_description": "My Content Description",
"$og_image_url": "http://lorempixel.com/200/200/",
"$og_title": "46D6D28E-0390-40E4-A856-BD74F34D24C8",
"$publicly_indexable": 1,
"+click_timestamp": 1503684563,
"+clicked_branch_link": true,
"+is_first_session": false,
"+match_guaranteed": true,
"custom": "blue",
"random": "FE848A5B-78F7-42EC-A253-9F795FE91692",
"added": "1503684554354.33",
"~campaign": "new launch",
"~channel": "facebook",
"~creation_source": 3,
"~feature": "sharing",
"~id": 429691043152332059,
"~referring_link": "https://example.app.link/X7OsnWv9TF",
"~stage": "new person",
"~tags": [
"one",
"two"
]
}
}
But this the response I got:
{"+non_branch_link":"https:\/\/qr6x.test-app.link\/g5ynWCX7PI","+clicked_branch_link":false,"+is_first_session":false}
here is my code:
Branch branch = Branch.getInstance(context);
branch.initSession(new Branch.BranchReferralInitListener() {
@Override
public void onInitFinished(JSONObject referringParams, BranchError error) {
if (error == null) {
// params are the deep linked params associated with the link that the user clicked -> was re-directed to this app
// params will be empty if no data found
// ... insert custom logic here ...
try {
Log.e("myapp","no error");
Log.e("myapp", referringParams.toString());
String pictureID = referringParams.optString("asdasdasdasd", "");
if (pictureID.equals("")) {
Log.e("myapp","no ID");
}
else {
Log.e("myapp","ID "+pictureID);
}
} catch (Exception e) {
System.out.println(" " + e.toString());
}
} else {
Log.i("MyApp", error.getMessage());
}
}
}, intent.getData(), activity);
can anyone give any idea what I am doing wrong?