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

2024-05-09

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

非常感谢,

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...
                            }
                        }
                    }
                });
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

检查 Firebase 邀请是否引导至 Play 商店 的相关文章

随机推荐