android -`onitfined`方法在branch.io中未被调用



我是branch.io的新手,我正在遵循他们的正式文档。当我运行应用程序时,未调用onInitFinished方法。我在这里发现了同样的问题,但是解决方案中使用的术语 postBranchInitSession(null);对我来说是未知的,我试图找出答案,但没有得到任何东西。在其官方文档中,文档非常令人困惑,我没有得到一些东西

这是我的代码:

  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) {
    }

请帮助我!

在检查了StackOverFlow和其他网站上的许多问题和解决方案之后,我通过在应用程序中添加android:name="io.branch.referral.BranchApp"解决了此问题,如下所示:

<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>

Alex Bauer此处建议的

最新更新