首页 > 解决方案 > 是否应该从 Playstore 下载应用程序以跟踪安装情况?或者有没有其他方法可以进行安装跟踪测试

问题描述

我根据 docs.branch.io 集成和配置了 branch.io SDK,并从 branch.io 仪表板创建了一个链接以跟踪安装,但我只能看到点击计数器和应用程序重新打开计数器,但不显示安装计数器。清单.xml

<meta-data android:name="io.branch.sdk.BranchKey" android:value="my_live_key" />
    <meta-data android:name="io.branch.sdk.BranchKey.test" android:value="my_test_key" />

    <!-- Branch testing (TestMode "true" to simulate fresh installs on dev environment) -->
    <meta-data android:name="io.branch.sdk.TestMode" android:value="false" />


    <!-- Branch install referrer tracking -->
    <receiver android:name="io.branch.referral.InstallListener" android:exported="true">
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>

    <activity
        android:name=".activities.MainActivity"
        android:launchMode="singleTask"
        android:theme="@style/AppTheme.NoActionBar.Splash"
        android:windowSoftInputMode="adjustResize|stateHidden">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>


        <!-- Branch URI scheme -->
        <intent-filter>
            <data android:scheme="goalwise" android:host="open" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>


        <intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="https" android:host="xjgf5.app.link" />
            <data android:scheme="https" android:host="xjgf5-alternate.app.link" />
        </intent-filter>

应用类

@Override
public void onCreate() {
    super.onCreate();
    // Initialize the Branch object

    Branch.getAutoInstance(this);
}

MainActivity.java

@Override
protected void onStart() {
    super.onStart();

    Branch.getInstance().initSession(new Branch.BranchReferralInitListener() {
        @Override
        public void onInitFinished(JSONObject referringParams, BranchError error) {
            if (error == null) {
                Log.i("BRANCH SDK", referringParams.toString());
                // Retrieve deeplink keys from 'referringParams' and evaluate the values to determine where to route the user
                // Check '+clicked_branch_link' before deciding whether to use your Branch routing logic
            } else {
                Log.i("BRANCH SDK", error.getMessage());
            }
        }
    }, this.getIntent().getData(), this);

    IntegrationValidator.validate(MainActivity.this);

}

标签: androidbranch.io

解决方案


请更改清单文件中的以下行:

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

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

这将模拟安装,即​​使安装不是从 Play 商店进行的,Branch 也会在仪表板上报告。这称为测试模式。更多信息在这里


推荐阅读