检查 Firebase 邀请是否引导至 Play 商店
Check if Firebase invite led to the Play Store
在 Android 上使用 Firebase 邀请并在应用程序启动时访问动态链接时,有没有办法知道用户是刚刚通过邀请安装了该应用程序,还是已经安装了该应用程序?
非常感谢,
博尔哈
基于this Google product form post, the Firebase Dynamic Links library will only check for incoming deep links once per app lifetime, meaning you'd need to uninstall and reinstall the app for it to check again. This feeds into the behavior of the getInvitation()
方法,您似乎可以根据此方法的结果暗示该应用程序之前是否安装过。
对我来说,这似乎非常令人困惑。在 Branch.io we do it completely differently: your link data object will always contain an is_first_session
布尔值,您可以以您选择的任何方式以编程方式处理它。
编辑:感谢 Catalin Morosan 的回答
原来你可以用方法AppInviteReferral.isOpenedFromPlayStore(result.getInvitationIntent())
找出来。在单击邀请时运行的 activity 中:
// Create an auto-managed GoogleApiClient with access to App Invites.
mGoogleApiClientInvite = new GoogleApiClient.Builder(this)
.addApi(AppInvite.API)
.enableAutoManage(this, this)
.build();
// Check for App Invite invitations and launch deep-link activity if possible.
// Requires that an Activity is registered in AndroidManifest.xml to handle
// deep-link URLs.
boolean autoLaunchDeepLink = false;
AppInvite.AppInviteApi.getInvitation(mGoogleApiClientInvite, this, autoLaunchDeepLink)
.setResultCallback(
new ResultCallback<AppInviteInvitationResult>() {
@Override
public void onResult(AppInviteInvitationResult result) {
if (result.getStatus().isSuccess()) {
// Extract information from the intent
Intent intent = result.getInvitationIntent();
String invitationId = AppInviteReferral.getInvitationId(intent);
boolean alreadyUser = AppInviteReferral.isOpenedFromPlayStore(result.getInvitationIntent());
if (alreadyUser) {
// Do stuff...
} else {
// Do other stuff...
}
}
}
});
在 Android 上使用 Firebase 邀请并在应用程序启动时访问动态链接时,有没有办法知道用户是刚刚通过邀请安装了该应用程序,还是已经安装了该应用程序?
非常感谢,
博尔哈
基于this Google product form post, the Firebase Dynamic Links library will only check for incoming deep links once per app lifetime, meaning you'd need to uninstall and reinstall the app for it to check again. This feeds into the behavior of the getInvitation()
方法,您似乎可以根据此方法的结果暗示该应用程序之前是否安装过。
对我来说,这似乎非常令人困惑。在 Branch.io we do it completely differently: your link data object will always contain an is_first_session
布尔值,您可以以您选择的任何方式以编程方式处理它。
编辑:感谢 Catalin Morosan 的回答
原来你可以用方法AppInviteReferral.isOpenedFromPlayStore(result.getInvitationIntent())
找出来。在单击邀请时运行的 activity 中:
// Create an auto-managed GoogleApiClient with access to App Invites.
mGoogleApiClientInvite = new GoogleApiClient.Builder(this)
.addApi(AppInvite.API)
.enableAutoManage(this, this)
.build();
// Check for App Invite invitations and launch deep-link activity if possible.
// Requires that an Activity is registered in AndroidManifest.xml to handle
// deep-link URLs.
boolean autoLaunchDeepLink = false;
AppInvite.AppInviteApi.getInvitation(mGoogleApiClientInvite, this, autoLaunchDeepLink)
.setResultCallback(
new ResultCallback<AppInviteInvitationResult>() {
@Override
public void onResult(AppInviteInvitationResult result) {
if (result.getStatus().isSuccess()) {
// Extract information from the intent
Intent intent = result.getInvitationIntent();
String invitationId = AppInviteReferral.getInvitationId(intent);
boolean alreadyUser = AppInviteReferral.isOpenedFromPlayStore(result.getInvitationIntent());
if (alreadyUser) {
// Do stuff...
} else {
// Do other stuff...
}
}
}
});