# Launcher

public interface **Launcher** **This interface is deprecated.**   

Starting December 2025, Instant Apps cannot be published through Google Play, and all Google
Play services Instant APIs will no longer work. To continue optimizing for user growth, we
encourage developers to refer users to their regular app or game, and using deeplinks to
redirect them to specific journeys or features when relevant.

API for launching instant apps. For example, browsers can use this API to check if given
URL has an associated instant app and obtain an intent that can be used to launch it.

### Constant Summary

|---|---|---|
| [String](https://developer.android.com/reference/java/lang/String.html) | [EXTRA_DO_NOT_LAUNCH_INSTANT_APP](https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#EXTRA_DO_NOT_LAUNCH_INSTANT_APP) | Boolean extra with true value added to the fallback intent passed to `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)`. |
| [String](https://developer.android.com/reference/java/lang/String.html) | [EXTRA_IS_REFERRER_TRUSTED](https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#EXTRA_IS_REFERRER_TRUSTED) | Boolean extra that can be attached to the intent you obtained from `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)` or `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppLaunchData(java.lang.String)`. |
| [String](https://developer.android.com/reference/java/lang/String.html) | [EXTRA_IS_USER_CONFIRMED_LAUNCH](https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#EXTRA_IS_USER_CONFIRMED_LAUNCH) | Boolean extra that can be attached to the intent you obtained from `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)` or `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppLaunchData(java.lang.String)`. |
| [String](https://developer.android.com/reference/java/lang/String.html) | [EXTRA_TRUSTED_REFERRER_PKG](https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#EXTRA_TRUSTED_REFERRER_PKG) | String extra that can be attached to the intent you obtained from `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)` or `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppLaunchData(java.lang.String)`. |

### Public Method Summary

|---|---|
| abstract [InstantAppIntentData](https://developers.google.com/android/reference/com/google/android/gms/instantapps/InstantAppIntentData) | [getInstantAppIntentData](https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent))([String](https://developer.android.com/reference/java/lang/String.html) url, [Intent](https://developer.android.com/reference/android/content/Intent.html) fallbackIntent) Checks if the given URL can be launched as an instant app on this device. |
| abstract Task\<[LaunchData](https://developers.google.com/android/reference/com/google/android/gms/instantapps/LaunchData)\> | [getInstantAppLaunchData](https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppLaunchData(java.lang.String))([String](https://developer.android.com/reference/java/lang/String.html) url) Returns `https://developers.google.com/android/reference/com/google/android/gms/instantapps/LaunchData` that can be used to start an instant app. |
| abstract boolean | [initializeIntentClient](https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#initializeIntentClient())() Initializes the client for getting intents for launching instant apps. |

## Constants

#### public static final [String](https://developer.android.com/reference/java/lang/String.html)
**EXTRA_DO_NOT_LAUNCH_INSTANT_APP**

Boolean extra with true value added to the fallback intent passed to `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)`. It indicates to the fallback intent
handler that the intent was started after a failure to load an instant app so that the
handler will not attempt to launch an instant app while handling this fallback
intent.

Meant for use by apps that want to launch instant apps, e.g. web browsers.

##### See Also

- `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)`
Constant Value: "com.google.android.gms.instantapps.DO_NOT_LAUNCH_INSTANT_APP"

#### public static final [String](https://developer.android.com/reference/java/lang/String.html)
**EXTRA_IS_REFERRER_TRUSTED**

Boolean extra that can be attached to the intent you obtained from `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)` or `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppLaunchData(java.lang.String)`.

Meant for use by apps that want to launch instant apps, e.g. web browsers.

When the instant app URL click happens within your app, the you can attach an extra
`https://developer.android.com/reference/android/content/Intent.html#EXTRA_REFERRER`
with the URI to which the click should be attributed, respecting referrer policy. For
example, a web browser can attach the URI of the web page on which this link was
clicked.

If you are certain what the referrer is you should set this extra to true. When the
referrer is sent by an external party and it cannot be verified, then you should set
this to false.

##### See Also

- `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)`
Constant Value: "com.google.android.gms.instantapps.IS_REFERRER_TRUSTED"

#### public static final [String](https://developer.android.com/reference/java/lang/String.html)
**EXTRA_IS_USER_CONFIRMED_LAUNCH**

Boolean extra that can be attached to the intent you obtained from `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)` or `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppLaunchData(java.lang.String)`.

Meant for use by apps that want to launch instant apps, e.g. web browsers.

The value indicates whether you have obtained user confirmation for this instant app
launch. Confirmation should be explicit and for this specific launch. This may be used
to determine whether user confirmation should be obtained by the instant app launcher.
For example, if you have a 'Launch instant app' button that launches the intent then it
would be appropriate to set this extra to true so that user is not redundantly asked if
they want to launch instant app by the instant apps runtime. This is a suggestion and
may not always result in suppression of additional user confirmation.

##### See Also

- `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)`
Constant Value: "com.google.android.gms.instantapps.IS_USER_CONFIRMED_LAUNCH"

#### public static final [String](https://developer.android.com/reference/java/lang/String.html)
**EXTRA_TRUSTED_REFERRER_PKG**

String extra that can be attached to the intent you obtained from `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)` or `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppLaunchData(java.lang.String)`.

Meant for use by apps that want to launch instant apps, e.g. web browsers.

String extra containing the package name of the Android app where the instant app
URL click happened. For example, it would contain the package name of your browser
application which is launching instant app.

You should set this if conditions for `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#EXTRA_IS_REFERRER_TRUSTED` are met.

##### See Also

- `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)`
- `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#EXTRA_IS_REFERRER_TRUSTED`
Constant Value: "com.google.android.gms.instantapps.TRUSTED_REFERRER_PKG"

## Public Methods

#### public abstract [InstantAppIntentData](https://developers.google.com/android/reference/com/google/android/gms/instantapps/InstantAppIntentData)
**getInstantAppIntentData** ([String](https://developer.android.com/reference/java/lang/String.html) url, [Intent](https://developer.android.com/reference/android/content/Intent.html) fallbackIntent)

Checks if the given URL can be launched as an instant app on this device. Returned
data object describes whether the link should launch an instant app, and if so provides
an activity Intent to launch an instant app via `https://developer.android.com/reference/android/content/Context.html#startActivity(android.content.Intent)`.

Meant for use by apps that want to launch instant apps, e.g. web browsers.

After calling this method check `https://developers.google.com/android/reference/com/google/android/gms/instantapps/InstantAppIntentData#getMatchResult()` to see if the intent obtained from
`https://developers.google.com/android/reference/com/google/android/gms/instantapps/InstantAppIntentData#getIntent()` should be used to launch an instant app.
Before launching, the following extras can be attached as appropriate: `https://developer.android.com/reference/android/content/Intent.html#EXTRA_REFERRER`,`https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#EXTRA_TRUSTED_REFERRER_PKG`,
`https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#EXTRA_IS_REFERRER_TRUSTED`, `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#EXTRA_IS_USER_CONFIRMED_LAUNCH`, `https://developer.android.com/reference/android/provider/Browser.html#EXTRA_APPLICATION_ID`,
`android.nfc.NfcAdapter#EXTRA_NDEF_MESSAGES`,
`android.nfc.NfcAdapter#EXTRA_TAG`, and
`android.nfc.NfcAdapter#EXTRA_ID`.

Even after the intent is launched the instant app is not guaranteed to be launched
due to changing conditions on device. In this case the runtime will launch the provided
`fallbackIntent`. `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#EXTRA_DO_NOT_LAUNCH_INSTANT_APP` with a `true` value will be added
to the `fallbackIntent` to indicate to the Activity handling it that it
should not attempt to launch an instant app while handling this
`fallbackIntent`. For example, if `fallbackIntent` is a URL
intent that points back to the same browser that attempted to launch instant app then
the browser should check this extra and avoid launching instant app again to prevent an
infinite redirect loop.

This is a fast on-device API. `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#initializeIntentClient()` can be used to pre-initialize the client to further
speed up lookup.

##### Parameters

| url | URL for which an instant app is needed |
| fallbackIntent | Activity Intent that will be run by the handler of the returned instant app Intent when it cannot launch an instant app. The `fallbackIntent`'s URI must match `url`. The Activity targeted by `fallbackIntent` must have `https://developer.android.com/reference/android/content/Intent.html#CATEGORY_BROWSABLE` in its intent filter. If `fallbackIntent` is null or these conditions are not met then, when necessary, an implicit Intent with the same URL will be sent instead of `fallbackIntent`. |
|---|---|

##### Returns

- launch data that can potentially start an instant app, or indicate that instant app cannot be launched because it is unavailable for given URL or user prefers viewing URL in browser.

#### public abstract Task\<[LaunchData](https://developers.google.com/android/reference/com/google/android/gms/instantapps/LaunchData)\>
**getInstantAppLaunchData** ([String](https://developer.android.com/reference/java/lang/String.html) url)

Returns `https://developers.google.com/android/reference/com/google/android/gms/instantapps/LaunchData`
that can be used to start an instant app.

Meant for use by apps that want to launch instant apps, e.g. web browsers.

This method provides extra information such as app icon and title in addition to a
lookup performed by `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)`. It may involve server requests and
may be slower.

If an instant app can be launched for the given URL then `https://developers.google.com/android/reference/com/google/android/gms/instantapps/LaunchData#getIntent()`
will return an intent that can be used to start the instant app. Otherwise, it will
return null. Extras can be attached to the intent similarly to those described in
`https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)`.

When an intent is returned it is not guaranteed that an instant app can be launched.
In such cases, when the returned intent is started there will be no callback to the
caller to indicate failure to launch an instant app. Implicit intent to view the URL
will be launched instead.

This method may involve RPCs to the server and may be slower than `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)`.

##### Parameters

| url | the URL for which an instant app is needed. |
|---|---|

##### Returns

- `https://developers.google.com/android/reference/com/google/android/gms/instantapps/LaunchData`

##### See Also

- `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)`

#### public abstract boolean
**initializeIntentClient** ()

Initializes the client for getting intents for launching instant apps. This can
optionally be done prior to invoking `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)` in order to perform initialization
ahead of time.

Returns true if initialization succeeded, false if it failed (in which case all
future invocations of `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)` will return null.

Meant for use by apps that want to launch instant apps, e.g. web browsers.

##### See Also

- `https://developers.google.com/android/reference/com/google/android/gms/instantapps/Launcher#getInstantAppIntentData(java.lang.String,%20android.content.Intent)`