Android Intents with ChromeA little known feature in Android lets you launch apps directly from a web page via an Android Intent. One scenario is launching an app when the user lands on a page, which you can achieve by embedding an iframe in the page with a custom URI-scheme set as the The functionality has changed slightly in Chrome for Android, versions 25 and later. It is no longer possible to launch an Android app by setting an iframe's SyntaxThe best practice is to construct an intent anchor and embed that into the page so the user can launch the app. This gives you a lot more flexibility in controlling how apps are launched, including the ability to pass extra information into the app via Intent Extras. The basic syntax for an intent-based URI is as follows: intent: See the Android source for parsing details. ExampleHere's an intent that launches the Zxing barcode scanner app. It follows the syntax thus: intent: To launch the Zxing barcode scanner app, you encode your <a href="intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end"> Take a QR code </a> See the Android Zxing Manifest, which defines the package and the host. ConsiderationsIf the activity you invoke via an intent contains extras, you can include these as well. Only activities that have the category filter, android.intent.category.BROWSABLE are able to be invoked using this method as it indicates that the application is safe to open from the Browser. |
|