當在Android上啓動應用時使用Firebase邀請並訪問動態鏈接時,是否有辦法知道用戶是否剛剛安裝了該應用,感謝邀請或者是否已經安裝?檢查Firebase邀請是否已導致Play商店
非常感謝,
博爾哈
當在Android上啓動應用時使用Firebase邀請並訪問動態鏈接時,是否有辦法知道用戶是否剛剛安裝了該應用,感謝邀請或者是否已經安裝?檢查Firebase邀請是否已導致Play商店
非常感謝,
博爾哈
編輯:感謝克特林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...
}
}
}
});
基於this Google product form post,在火力地堡動態鏈接庫將只檢查每個應用程序一生只有一次進入深層鏈接,這意味着你需要卸載並重新安裝應用程序吧再次檢查。這提供了getInvitation()
方法的行爲,看起來您可以根據此方法的結果暗示應用是否先前已安裝。
對我來說,這似乎非常混亂。在Branch.io我們做的完全不同:您的鏈接數據對象將始終包含一個is_first_session
布爾值,您可以通過編程方式以您選擇的任何方式進行處理。
這不起作用。 AppInviteReferral.hasReferral()在兩種情況下均返回true。我發現AppInviteReferral.isOpenedFromPlayStore()應該像我們想要的那樣工作。 –
@CatalinMorosan你是對的我到現在還沒有機會測試它,因爲我的應用不在Play商店。現在它和你的答案是有效的,而不是hasReferral() – Borja