在Android火力地堡动态链接没有生存的安装过程
我的问题是类似this recent question for iOS。在Android火力地堡动态链接没有生存的安装过程
火力地堡动态联系工作与应用已有的设备上如预期,但我无法得到一个复诊时,我从Play商店安装应用程序(目前在测试版)。
具体而言,AppInviteReferral.hasReferral(getIntent())
返回false
当应用程序从PlayStore测试版频道安装时。
根据连锁答案,动态链接工作的大部分时间,但有可能是无证边缘的情况下,这将导致失败。我还是要强调的是具体到我的情况,所以你可能会帮我看看有什么遗漏在我的设置。
- 我只是刚刚从
10.2.4
将我的Firebase库更新为10.2.6
。更改日志中的Firebase邀请库没有更改。
如果它的事项,下面是我在其中包括库的顺序
compile 'com.google.firebase:firebase-core:10.2.6'
compile 'com.google.firebase:firebase-messaging:10.2.6'
compile 'com.google.firebase:firebase-auth:10.2.6'
compile 'com.google.firebase:firebase-database:10.2.6'
compile 'com.google.firebase:firebase-invites:10.2.6'
-
我
SplashScreenActivity.java
兼作发射活动,并接受活动并处理深层链接。下面是在AndroidManifest<activity android:name=".ui.setup.SplashScreenActivity" android:label="@string/app_name" android:theme="@style/SplashTheme"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <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="deeplinks.myCompanyDomain.com" android:pathPrefix="/mobile"/> </intent-filter> </activity>
SplashScreenActivity.java
活动声明不setContentView(int id)
。它只是使用主题来显示启动画面,而应用程序资源的其余部分“加载”。我不知道这是否重要,但是我把它放在那里。事情上的应用程序开始之前,我检查,以确保应用程序具有所需的权限。一个
continueIntoApp()
方法(我想不出一个更好的名字)会在用户发现它具有所需的权限时,或者在用户向应用程序授予它所需的全部四个权限之后将其带入应用程序。-
continueIntoApp()
是实现Firebase Dynamic Links Docs上的所有代码的地方。我首先建立并连接一个GoogleApiClient
。GoogleApiClient googleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this, new GoogleApiClient.OnConnectionFailedListener() { @Override public void onConnectionFailed(@NonNull ConnectionResult connectionResult) { LogUtils.e("Deeplink connection failed"); LogUtils.e(connectionResult.getErrorMessage()); LogUtils.e(String.valueOf(connectionResult.getErrorCode())); } }) .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { @Override public void onConnected(@Nullable Bundle bundle) { LogUtils.d("Connected!"); } @Override public void onConnectionSuspended(int i) { LogUtils.e("Connection suspended!"); } }) .addApi(AppInvite.API) .build(); googleApiClient.connect();
正如顺便说一句,动态链接文档假设开发者已经知道如何设置一个GoogleApiClient
。我没有。经过几次折腾几天,我无意中发现了#connect()
方法,实际上得到了GoogleApiClient
做什么是应该做的。
在此之后,我检查是否有AppInviteReferral
推荐。
//boolean autoLaunchDeepLink = true;
if(AppInviteReferral.hasReferral(getIntent())){
LogUtils.d("Referral found!");
AppInvite.AppInviteApi.getInvitation(googleApiClient, SplashScreenActivity.this, true)
.setResultCallback(new ResultCallback<AppInviteInvitationResult>() {
@Override
public void onResult(@NonNull AppInviteInvitationResult appInviteInvitationResult) {
LogUtils.d("Processing appInviteInvitationResult...");
if(appInviteInvitationResult.getStatus().isSuccess()){
Intent intent = appInviteInvitationResult.getInvitationIntent();
String deepLink = AppInviteReferral.getDeepLink(intent);
LogUtils.d("Deeplink is " + deepLink);
AppConfig appConfig = new AppConfig(SplashScreenActivity.this);
appConfig.put(ModelKeys.TEMP_JOIN_BRANCH_DEEPLINK, deepLink);
startActivity(new Intent(SplashScreenActivity.this, MainActivity.class));
//parseDeeplink(deepLink);
}else {
LogUtils.d("No deeplink found!");
startActivity(new Intent(SplashScreenActivity.this, MainActivity.class));
}
}
});
}else {
LogUtils.d("No referral found!");
startActivity(new Intent(SplashScreenActivity.this, MainActivity.class));
}
你会发现我已经注释掉autoLaunchDeepLink
,默认情况下,通过对true
AppInvite.AppInviteApi.getInvitation()
。我仍然不确定何时应将此值设置为true
或false
。我也不知道如何在动态链接全新安装后(autoLaunchDeepLink
为false
),Firebase知道如何“启动动态链接”。
这就像动态链接实现一样。我的问题是如上所述:当我已经安装了应用程序时,AppInviteReferral.hasReferral(getIntent())
返回true
,并且代码正常运行。当用户遵循动态链接到PlayStore并下载测试版时,AppInviteReferral.hasReferral(getIntent())
返回false
,并且不遵循深度链接。
这是怎么发生的?我错过了什么?
我不认为你错过了任何东西 - 它确实看起来像Play商店不会发送INSTALL_REFERRER广播用于Beta频道安装,并且它的引用者被用作传递深度链接后处理的机制,安装。
如果您使用的是产品应用程序,它应该可以正常工作,但是Beta版安装不支持该功能有点好奇。
有同样的问题。我们的问题是,我们在AndroidManifest.xml中有两个几乎相似的意图过滤器,这导致Google Play失去了我们想要的意图。它没有显示“继续”按钮,而是重定向到我们卸载/打开播放页面。
暗示与 https://firebase.google.com/docs/dynamic-links/android/receive
我即将实施火力地堡动态链接自己在我的应用程序,所以我没有真正回答这个问题的工作......我只是想指出的是,实际上我正在从Adjust SDK迁移到Firebase,并且我从Play商店测试了我的Beta版apk:使用Adjust INSTALL_REFERRER即使从Beta版渠道也能正确发送。 –
我有同样的问题,我的DEBUG版本的应用程序完全检测到动态链接,但是当我将我的应用程序的发布版本发布到ALPHA频道时,我无法接收我的启动画面中的动态链接...如果你找到解决方案,那么请做报告。 –
谢谢伊恩。它现在完美。这个问题有点奇怪。 – wsgeorge