SimpleCoder
SimpleCoder

Reputation: 1705

Branch link donot proivide data when clicked and opened in android app

I have created link using branch sample app and set everything as mentioned. Branch sample app When a link is created i can see the data in branch dashboard associated with that link. But whenever i click that link in my android device and app opens i get sessionparams and referparams both empty I have tried

 Branch branch = Branch.getInstance();
    branch.initSession(new Branch.BranchReferralInitListener() {
        @Override
        public void onInitFinished(JSONObject referringParams, BranchError error) {
               String referringParamsString = (String) sessionParams.toString();
                      //{"+clicked_branch_link":false,"+is_first_session":false}
               JSONObject sessionParams = Branch.getInstance().getFirstReferringParams();
        //{Empty }

         }
     });

Please help, earlier it was working fine Now its not working . I have tried changing Branch.getAutoInstance(this); ->Branch.getAutoInstance(this, true); used JSONObject sessionParams = Branch.getInstance().getFirstReferringParams(); without Branch session. Still i am not getting any values. Thanks in advance.

Upvotes: 2

Views: 2388

Answers (1)

Amruta Deshmukh
Amruta Deshmukh

Reputation: 1045

Full disclosure, I work at Branch

Session referring parameters will return the Branch link parameters for the current link which redirected the user to the app. The first session parameters, return the link parameters for the first link which brought the user to the app.

In the case of your app, it looks like a key mismatch issue i.e. your app could be using the test key while you are using the links created in the live version of the app for testing. If the Branch key used by your app is not the same as the Branch key for the link, the Branch SDK will not be able to fetch the link parameters and will return +clicked_branch_link:false for session parameters and will return null for the first referred session parameters.

To check if your app is using the test key, you can create a link in the test version of your app on the Branch dashboard and click on the link. If you get +clicked_branch_link:true it means your app is using the test key. (The links in the test version are of the format: https://yourapp-test.app.link/sbjdsRS).

You can ensure your app is using the live key instead of the test key by:

  1. Completely removing the test key from your Android Manifest OR

  2. Making sure you are not enabling Test Mode in your Android Manifest or your Application.

Upvotes: 2

Related Questions