gpt4 book ai didi

android - 检查 Firebase 邀请是否引导至 Play 商店

转载 作者:太空狗 更新时间:2023-10-29 13:55:51 26 4
gpt4 key购买 nike

在 Android 上使用 Firebase 邀请并在应用启动时访问动态链接时,有没有办法知道用户是因邀请刚刚安装了该应用还是已经安装了该应用?

非常感谢,

博尔哈

最佳答案

编辑:感谢 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 邀请是否引导至 Play 商店,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39808749/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com