The InstallReferrer extension for MIT App Inventor allows you to interact with the Google Play Store to retrieve install referrer information. This includes details about the referrer URL, click timestamp, install timestamp, and whether the app was installed via Google Play Instant.
Methods
FetchAppInstallTime
- Description: Retrieves the app install time in seconds since the Unix epoch. This indicates when the app was first installed.
- Return Type: Number
- Block Screenshot:
FetchGooglePlayInstantParam
- Description: Checks if the app was installed via Google Play Instant. Returns
true
if installed via Google Play Instant, otherwisefalse
. - Return Type: Boolean
- Block Screenshot:
FetchReferrerClickTime
- Description: Retrieves the referrer click time in seconds since the Unix epoch. This indicates when the referrer URL was clicked.
- Return Type: Number
- Block Screenshot:
FetchReferrerDetails
- Description: Fetches install referrer details from the Play Store. Includes referrer URL, referrer click timestamp, app install timestamp, and Google Play Instant status. Should be called only once after app installation.
- Block Screenshot:
GetDeepLinkUrl
- Description: Retrieves the deep link URL from the referrer details if available. Assumes the deep link is part of the referrer URL.
- Return Type: Text
- Block Screenshot:
InitiateConnection
- Description: Initiates a connection to the Google Play Store to retrieve install referrer information. Includes automatic retry logic. On success, the
OnConnectionEstablished
event is triggered. - Block Screenshot:
IsReferrerDetailsFetched
- Description: Checks if the referrer details have already been fetched. Returns
true
if details have been fetched, otherwisefalse
. - Return Type: Boolean
- Block Screenshot:
IsReferrerFeatureSupported
- Description: Checks if the Install Referrer API is supported on the device. Returns
true
if supported, otherwisefalse
. - Return Type: Boolean
- Block Screenshot:
ResetFetchedState
- Description: Resets the fetched state to allow fetching referrer details again. Use with caution, as referrer details are typically only fetched once after installation.
- Block Screenshot:
TerminateConnection
- Description: Ends the connection to the Google Play Store. Should be called to release resources once referrer details are retrieved.
- Block Screenshot:
WasReferrerClickedRecently
- Description: Checks if the install referrer was clicked within the last 24 hours. Returns
true
if the click occurred within the last 24 hours, otherwisefalse
. - Return Type: Boolean
- Block Screenshot:
Events
OnConnectionEstablished
-
Description: Triggered when the connection to the Play Store is established or fails. The success parameter indicates if the connection was successful.
-
Parameter:
success
(Boolean)
-
Block Screenshot:
OnDisconnected
- Description: Triggered when the connection to the Play Store is unexpectedly disconnected.
- Block Screenshot:
OnReferrerDetailsFetchFailed
-
Description: Triggered when there is an error fetching the referrer details. Provides an error message describing the failure.
-
Parameter:
error
(Text)
-
Block Screenshot:
OnReferrerDetailsFetched
-
Description: Triggered when referrer details are successfully retrieved. Provides referrer URL, referrer click timestamp, app install timestamp, and Google Play Instant status.
-
Parameters:
referrerUrl
(Text)referrerClickTime
(Number)appInstallTime
(Number)googlePlayInstant
(Boolean)
-
Block Screenshot: