检查Firebase邀请是否导致Play商店(Check if Firebase invite led to the Play Store)

编程入门 行业动态 更新时间:2024-10-27 14:29:35
检查Firebase邀请是否导致Play商店(Check if Firebase invite led to the Play Store)

在Android上启动应用程序时使用Firebase邀请并访问动态链接时,有没有办法知道用户是否刚刚安装了应用程序,这要归功于邀请或者是否已经安装了应用程序?

非常感谢,

博尔哈

When using Firebase invites and accessing the dynamic links at the startup of the app on Android, is there a way to know whether the user just installed the app thanks to the invite or whether it was already installed?

Many thanks,

Borja

最满意答案

编辑:感谢Catalin Morosan的答案

事实证明,您可以使用AppInviteReferral.isOpenedFromPlayStore(result.getInvitationIntent())方法找到它。 在单击邀请时运行的活动中:

// 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... } } } });

EDIT: Thanks to Catalin Morosan for the answer

It turns out that you can find this out using method AppInviteReferral.isOpenedFromPlayStore(result.getInvitationIntent()). In the activity that runs when you click on the invitation:

// 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... } } } });

更多推荐

本文发布于:2023-07-05 07:47:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1034835.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:商店   Play   Firebase   Check   Store

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!