EDIT: Merci à Catalin Morosan pour la réponse
Il se trouve que vous pouvez trouver en utilisant la méthode AppInviteReferral.isOpenedFromPlayStore(result.getInvitationIntent())
. Dans l'activité qui s'exécute lorsque vous cliquez sur l'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...
}
}
}
});
Cela ne fonctionne pas. AppInviteReferral.hasReferral() renvoie true pour les deux situations. Je vois qu'il y a AppInviteReferral.isOpenedFromPlayStore() qui devrait se comporter comme nous le voulons. –
@CatalinMorosan vous avez raison, je ne l'avais pas eu la chance de le tester jusqu'à présent parce que mon application n'a pas été sur le Play Store. Maintenant c'est et votre réponse fonctionne par opposition à hasReferral() – Borja