【发布时间】:2017-04-25 23:13:37
【问题描述】:
我正在使用 Branch.io 进行深度链接。如果应用程序已经安装,一切正常,但如果这是安装应用程序后的第一次运行,则永远不会执行以下代码(在 onStart 内)
Branch branch = Branch.getAutoInstance(getApplicationContext());
branch.initSession(new Branch.BranchUniversalReferralInitListener() {
@Override
public void onInitFinished(BranchUniversalObject branchUniversalObject,
LinkProperties linkProperties, BranchError branchError) {
DeepLinkUtil.processBranchIntent(branchUniversalObject);
}
});
我不是从 PlayStore 安装,而是从服务器下载。当我点击链接时,在浏览器中开始下载,然后我可以点击下载的 APK 进行安装。安装后,第一次打开APK时,上面的代码永远不会执行。
我在 onStart() 中添加了以下代码:
Branch branch = Branch.getAutoInstance(getApplicationContext());
JSONObject installParams = branch.getFirstReferringParams();
if (installParams == null) {
Log.d(TAG, "processIntent: installParams: null");
} else {
Log.d(TAG, "processIntent: installParams: " + installParams.toString());
}
安装后第一次运行时,安装参数不为空,而是为空 - {}。第二次运行时,安装参数包含来自点击链接的正确信息,但“is_first_session”现在为假。
我确实在清单中注册了安装引用接收器,但我不清楚它是否适用于 PlayStore 仅安装或任何安装。
我还需要做什么才能在安装后第一次运行时获得推荐链接?
【问题讨论】:
标签: android deep-linking branch.io