Google Play Instant API reference

In addition to the com.google.android.gms.instantapps package APIs, the Android-specific Instant App API provides methods to help you work within the instant apps context. To use this library, located in the com.google.android.instantapps package, include the following Gradle dependency in the build config file for any feature module that contains calls to this API:

compile 'com.google.android.instantapps:instantapps:1.1.0'

Class Summary

Class Description
InstantApps Google Play Instant supporting API.

Class InstantApps

java.lang.Object
   ↳ com.google.android.instantapps.InstantApps

The API supporting Google Play Instant.

Summary

Public methods
static boolean

isInstantApp(Context context)

This method returns true if the current process is an instant app.

static boolean

showInstallPrompt(Activity activity, Intent postInstallIntent, int requestCode, String referrer)

Shows a dialog that allows the user to install the current instant app.

static boolean

showInstallPrompt(Activity activity, int requestCode, String referrer)

Shows a dialog that allows the user to install the current instant app.

Deprecated in Instant Apps SDK v1.1. Implement showInstallPrompt(Activity, Intent, int, String) instead.

Public methods

isInstantApp

boolean isInstantApp(Context context)

This method indicates whether the app in the current process is an instant app.

Parameters
context Current activity or application context.
Returns
boolean Returns true if the current process is an instant app process.

showInstallPrompt

public static boolean showInstallPrompt(Activity activity, Intent postInstallIntent, int requestCode, String referrer)

Shows a dialog that allows the user to install the current instant app. If the currently-running process is an installed app, this method does nothing. You must provide a post-install intent, which the system uses to start the application after install is complete.

Parameters
activity The activity launching the dialog.
postInstallIntent The intent to launch after the instant app has been installed. This intent *must* resolve to an activity in the installed app package, or it isn't used.
requestCode The request code to pass to Activity#startActivityForResult.
referrer The install referrer string.
Returns
boolean True if the install dialog is successfully displayed.

showInstallPrompt

boolean showInstallPrompt(Activity activity, int requestCode, String referrer)

This method was deprecated in Instant Apps SDK v1.1.
Implement showInstallPrompt(Activity, Intent, int, String) instead.

Parameters
activity The activity launching the dialog.
requestCode The requestCode to pass to Activity.startActivityForResult().
referrer The install referrer string that tracks conversions from instant app to installed app.
Returns
boolean If the install dialog is successfully displayed