Entry point for Instant Apps APIs.
Public Method Summary
staticActivityCompat |
getActivityCompat(Activity
activity)
Returns a helper for Activity functionality that can be used to retrieve
information about running instant apps or installed apps.
|
staticInstantAppsClient |
getInstantAppsClient(Activity
activity)
Creates a new instance of
InstantAppsClient
for use in anActivity .
|
staticInstantAppsClient |
getInstantAppsClient(Context
context)
Creates a new instance of
InstantAppsClient
for use in a non-activityContext .
|
staticLauncher | |
staticPackageManagerCompat |
getPackageManagerCompat(Context
context)
Returns a helper for PackageManager functionality that can be used to retrieve
information about running instant apps or installed apps.
|
static boolean |
showInstallPrompt(Activity
activity,Intent
postInstallIntent, int requestCode,Stringreferrer)
Shows a dialog that allows the user to install the current instant app.
|
Inherited Method Summary
Public Methods
public staticActivityCompat getActivityCompat(Activity activity)
Returns a helper for Activity functionality that can be used to retrieve information about running instant apps or installed apps.
Information about instant apps will only be returned for currently running instant
apps that include the package name of the calling application in a
<instant:uses-app>
element under the
<application>
element in their manifest.
Parameters
activity | the activity on which to query information. |
---|
public staticInstantAppsClient getInstantAppsClient(Activity activity)
Creates a new instance ofInstantAppsClient
for use in anActivity
.
Error resolutions will be automatically launched from the provided Activity, displaying
UI when necessary.
public staticInstantAppsClient getInstantAppsClient(Context context)
Creates a new instance ofInstantAppsClient
for use in a non-activityContext
.
Error resolutions will be automatically launched from the provided Context, displaying
system tray notifications when necessary.
public staticLauncher getLauncher(Context context)
Returns an API for launching instant apps by URL.
This method will cache a Launcher instance for the application context; you can invoke this method in many places in your code (without having to pass around a Launcher interface) without incurring extra allocations.
Parameters
context | the current context |
---|
public staticPackageManagerCompat getPackageManagerCompat(Context context)
Returns a helper for PackageManager functionality that can be used to retrieve information about running instant apps or installed apps.
This method will cache a PackageManagerCompat instance for the application context; you can invoke this method in many places in your code (without having to pass around a PackageManagerCompat interface) without incurring extra allocations.
Parameters
context | the current context |
---|
public static booleanshowInstallPrompt(Activityactivity, Intent postInstallIntent, int requestCode,Stringreferrer)
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. If the app is currently in Pre-Registration, it will allow the user to pre-register for the app and return to the instant app upon completion. A post-install intent must be provided, which will be used to start the application after install is complete (if applicable).
Parameters
activity | The activity launching the dialog |
---|---|
postInstallIntent | The intent to launch after the instant app has been installed. If postInstallIntent is not provided or invalid, it falls back to the default launcher activity. |
requestCode | The request code to pass to
startActivityForResult(Intent, int) |
referrer | The install referrer string |
Returns
- if the install prompt is successfully displayed