Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - `onInitFinished` method is not callled in Branch.io

I am new in branch.io and i am following their official documentation. when i run my application onInitFinished method is not called. i had found the same question here but a term postBranchInitSession(null); used in the solution which is unknown to me and i tried to find out but did not get anything. on its official documentation there is very confusing documentation, from that documentation i am not getting something

here is my code:

  try {
        branch = Branch.getInstance();
        branch.initSession(new Branch.BranchReferralInitListener() {
            @Override
            public void onInitFinished(JSONObject referringParams, BranchError error) {
                if (error == null) {
                    Log.d("Splash onStart", referringParams.toString());

                } else {
                    Log.i("MyApp", error.getMessage());
                }
            }
        }, this.getIntent().getData(), this);
    } catch (Exception ex) {

    }

Please help me!

like image 637
Shaifali Rajput Avatar asked Sep 06 '17 06:09

Shaifali Rajput


1 Answers

After checking so many Questions and solutions on StackOverFlow and other sites i have solved this problem by adding android:name="io.branch.referral.BranchApp" in application as shown below:

<application
     android:allowBackup="true"
     android:icon="@mipmap/ic_launcher"
     android:label="@string/app_name"
     android:supportsRtl="true"
     android:theme="@style/AppTheme"
     android:name="io.branch.referral.BranchApp">
     ...
</application>

as suggested here by Alex Bauer

like image 89
Shaifali Rajput Avatar answered Nov 09 '22 21:11

Shaifali Rajput