Google. Play. Instant. InstallLauncher
Provides methods that an instant app can use to display a Play Store install dialog.
Summary
This dialog will allow the user to install the current instant app as a full app.
Example code for the instant app's install button click handler: const int requestCode = 123; using (var activity = InstallLauncher.GetCurrentActivity()) using (var postInstallIntent = InstallLauncher.CreatePostInstallIntent(activity)) { InstallLauncher.PutPostInstallIntentStringExtra(postInstallIntent, "payload", "test"); InstallLauncher.ShowInstallPrompt(activity, requestCode, postInstallIntent, "referrer"); }
Example code for the installed app to retrieve the result: string payload = InstallLauncher.GetPostInstallIntentStringExtra("payload");
This is a C# implementation of the Java showInstallPrompt() method available in Google Play Services' InstantApps class.
Public static functions |
|
---|---|
CreatePostInstallIntent(AndroidJavaObject activity)
|
AndroidJavaObject
Creates an Intent for the Play Store to launch after installing the app.
|
GetPostInstallIntentStringExtra(string extraKey)
|
string
This method can be called from an installed app to obtain a string that was included in the postInstallIntent provided by an instant app via ShowInstallPrompt().
|
PutPostInstallIntentStringExtra(AndroidJavaObject postInstallIntent, string extraKey, string extraValue)
|
void
This method can be called with the Intent obtained from CreatePostInstallIntent to add a string extra that will be passed through to the installed app.
|
ShowInstallPrompt(string referrer)
|
void
Shows a dialog that allows the user to install the current instant app.
|
ShowInstallPrompt(AndroidJavaObject activity, int requestCode, AndroidJavaObject postInstallIntent, string referrer)
|
void
Shows a dialog that allows the user to install the current instant app.
|
Public static functions
CreatePostInstallIntent
AndroidJavaObject CreatePostInstallIntent( AndroidJavaObject activity )
Creates an Intent for the Play Store to launch after installing the app.
It will launch the specified activity. This Intent can be extended to contain additional extras for passing to the installed app. This object should be disposed after use.
Details | |
---|---|
Returns |
A wrapped Intent object. The AndroidJavaObject should be disposed.
|
GetPostInstallIntentStringExtra
string GetPostInstallIntentStringExtra( string extraKey )
This method can be called from an installed app to obtain a string that was included in the postInstallIntent provided by an instant app via ShowInstallPrompt().
It assumes that the current activity was the one that was launched by Play Store.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
The string extra value.
|
PutPostInstallIntentStringExtra
void PutPostInstallIntentStringExtra( AndroidJavaObject postInstallIntent, string extraKey, string extraValue )
This method can be called with the Intent obtained from CreatePostInstallIntent to add a string extra that will be passed through to the installed app.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
ShowInstallPrompt
void ShowInstallPrompt( string referrer )
Shows a dialog that allows the user to install the current instant app.
Details | |||
---|---|---|---|
Parameters |
|
ShowInstallPrompt
void ShowInstallPrompt( AndroidJavaObject activity, int requestCode, AndroidJavaObject postInstallIntent, string referrer )
Shows a dialog that allows the user to install the current instant app.
This method is a no-op if the current running process is an installed app. A post-install intent must be provided, which will be used to start the application after install is complete.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||
Exceptions |
|