AppInviteReferral

public class AppInviteReferral extends Object

Provides accessors to the referral data consisting of an invitation id and possibly a deep link if set using setDeepLink(Uri). The referral data is made available to the application when it is opened after a user accepts an invitation created with AppInviteInvitation.

When the user accepts an invitation and the application is not already installed, the user will enter a flow to install and open the application. After install the AppInvite referral data will be available and can be accessed using getInvitation(GoogleApiClient, android.app.Activity, boolean) .

If the app is already installed, the referral data is included in the intent returned from getIntent(). The deep link will launch the app into a specified activity if filters have been setup to trigger on the deeplink, see Enabling Deep Links for App Content.

In both cases, the referral data is made available to the application. To check if the referral data is present use hasReferral(Intent) and if true, then access the data using getInvitationId(android.content.Intent) and getDeepLink(android.content.Intent) from the intent returned from getInvitationIntent(). If the deep link was not set when creating the invitation, the invitationIntent will not include a deep link and the app will be start in its main activity.

Public Method Summary

static Intent
addPlayStoreReferrerToIntent(Intent playStoreReferrerIntent, Intent referralIntent)
This method was deprecated. Use getInvitation(GoogleApiClient, android.app.Activity, boolean) to access AppInvite referrer data rather than implementing a Play Store broadcast receiver.
static Intent
addReferralDataToIntent(String invitationId, String deepLink, Intent referralIntent)
This method was deprecated. Use getInvitation(GoogleApiClient, android.app.Activity, boolean) to access AppInvite referrer data rather than implementing a Play Store broadcast receiver.
static String
getDeepLink(Intent referralIntent)
Returns an deep link from an invitation if the deep link was set when the invitation was created.
static String
getInvitationId(Intent referralIntent)
Get the invitation id from the referralIntent.
static boolean
hasReferral(Intent referralIntent)
Determine if the referralIntent includes referral data.
static boolean
isOpenedFromPlayStore(Intent referralIntent)
Determine if the app was opened after installation from the play store.

Inherited Method Summary

Public Methods

public static Intent addPlayStoreReferrerToIntent (Intent playStoreReferrerIntent, Intent referralIntent)

This method was deprecated.
Use getInvitation(GoogleApiClient, android.app.Activity, boolean) to access AppInvite referrer data rather than implementing a Play Store broadcast receiver.

Extract the referrer data from the playStoreReferrerIntent as sent from the play store and add it to an intent that can then be sent to an application activity. The referrer broadcast is sent immediately after the application is opened after being installed from the play store. To access the broadcast intent, the application must implement a InstallReferrerReceiver broadcast receiver, the intent received is the playStoreReferrerIntent. The referrer data is extracted from the playStoreReferrerIntent and added to the referralIntent where it can then be retrieved from the referralIntent using getInvitationId(android.content.Intent) and getDeepLink(android.content.Intent).

Parameters
playStoreReferrerIntent The intent send with the play store broadcast.
referralIntent An Intent that the playStoreReferrerIntent referral data will be added to. If null, the referral data will not be added.
Returns
  • The referralIntent with the referral data or null if the referralIntent is null.

public static Intent addReferralDataToIntent (String invitationId, String deepLink, Intent referralIntent)

This method was deprecated.
Use getInvitation(GoogleApiClient, android.app.Activity, boolean) to access AppInvite referrer data rather than implementing a Play Store broadcast receiver.

Create a referral bundle from invitation id and deeplink, attach to the intent as an extra.

Parameters
invitationId Invitation id.
deepLink Deep link string.
referralIntent Intent to add the bundle to.
Returns
  • The referralIntent updated with the bundle extra.

public static String getDeepLink (Intent referralIntent)

Returns an deep link from an invitation if the deep link was set when the invitation was created.

Parameters
referralIntent Intent returned from getInvitationIntent() after Play Store install or getIntent() for an existing installed app.
Returns
  • The deep link if the deep link was set when creating the invitation, null otherwise.

public static String getInvitationId (Intent referralIntent)

Get the invitation id from the referralIntent.

Parameters
referralIntent Intent returned from getInvitationIntent() after Play Store install or getIntent() for an existing installed app.
Returns
  • The invitation id or null if not present. The invitation id should always be present if hasReferral(Intent) is true.

public static boolean hasReferral (Intent referralIntent)

Determine if the referralIntent includes referral data.

Parameters
referralIntent Intent returned from getInvitationIntent() after Play Store install or getIntent() for an existing installed app.
Returns
  • True if the referralIntent includes referral data, false otherwise.

public static boolean isOpenedFromPlayStore (Intent referralIntent)

Determine if the app was opened after installation from the play store.

Parameters
referralIntent Intent returned from getInvitationIntent() after Play Store install or getIntent() for an existing installed app.
Returns
  • True if the app was opened after Play Store installation, false otherwise.

Send feedback about...

Need help? Visit our support page.