You can launch apps directly from a web page on an Android device with an
[Android Intent](http://developer.android.com/guide/components/intents-filters). You can implement a user gesture to launch the app with a
custom scheme or use the `intent:` syntax.

Construct an intent anchor and embed it within a page, so the user can choose to
launch the app. This allows flexibility for how and when apps are launch,
which means you can pass information to the app with [Intent Extras](http://developer.android.com/guide/components/intents-filters#extras).

The basic syntax for an intent-based URI is as follows:

```text
intent:  
   HOST/URI-path // Optional host  
   #Intent;  
      package=\[string\];  
      action=\[string\];  
      category=\[string\];  
      component=\[string\];  
      scheme=\[string\];  
   end;
```

Refer to the [Android source code](https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/content/Intent.java?q=symbol:Intent.parseUri) for parsing details.

When an intent isn't resolved or an external application doesn't launch,
the user can be redirected to the fallback URL. You can specify a fallback URL
with an Intent Extra:

```text
S.browser_fallback_url=[encoded_full_url]
```

Use `S.<name>` define Intent Extras. This particular extra is
backwards-compatible. Chrome removes `browser_fallback_url` so the
target app doesn't see this value.

Chrome won't launch an external application in the following cases:

- The intent cannot be resolved. In other words, no app can handle the intent.
- A JavaScript timer tried to open an application without a user gesture.

### Examples

Here's an intent that launches the Zxing barcode scanner app:

```text
intent:  
   //scan/  
   #Intent;  
      package=com.google.zxing.client.android;  
      scheme=zxing;  
   end;
```

To launch the Zxing barcode scanner app, encode your `href` on the anchor:

```html
  <a href="intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end">
    Take a QR code
  </a>
```

See the [Android Zxing Manifest](https://github.com/zxing/zxing/blob/fa19d4758f38daa5d0ea6557af9a64721cfcce07/android/AndroidManifest.xml#L97), which defines the package and the host.

When a fallback URL is specified, the full URL looks as follows:

```html
   <a href="intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;S.browser_fallback_url=http%3A%2F%2Fzxing.org;end">
    Take a QR code
  </a>
```

Now the URL sends users to `zxing.org` if the app cannot be found, the link is
triggered by JavaScript without user gesture, or other cases where we don't
launch an external application.

## Considerations

If you invoke an [Android Activity](http://developer.android.com/guide/components/activities) with an Intent that contains [Extras](http://developer.android.com/guide/components/intents-filters#extras),
you can include these details, too.

Only activities with the category filter, [android.intent.category.BROWSABLE](http://developer.android.com/reference/android/content/Intent#CATEGORY_BROWSABLE)
can be invoked using this method, as it indicates that the application is safe
to open from the Browser.

Chrome won't launch an external app for a given Intent URI if:

- The Intent URI is redirected from a typed in URL;
- The Intent URI is initiated without user gesture.