检查Firebase邀请是否导致了Play商店 [英] Check if Firebase invite led to the Play Store

查看:99
本文介绍了检查Firebase邀请是否导致了Play商店的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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?

非常感谢,

Borja

推荐答案

感谢Catalin Morosan的回答

Thanks to Catalin Morosan for the answer

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

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

这篇关于检查Firebase邀请是否导致了Play商店的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆