检查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... } } } });更多推荐
发布评论