Chrome supports the protocol intent
. This is a not well documented protocol which can be used in Google Chrome on an Android device to open an app which has an “exported” activity.
The link in the web site needs to conform to the Android protocol syntax for intents.
<a href="intent://app.custom.device.local/customer/102#Intent;package=my.android.app.package;scheme=myscheme;end;">Link</a>
The app needs to have an activity available to the outside via an intent filter
.
<intent-filter> <action android:name="android.intent.action.VIEW"/> <data android:scheme="myscheme" android:host="app.custom.device.local" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE"/> </intent-filter>
intent-filter
sections. Put the above into a separate section if the activity already has an intent-filter section.
android.intent.action.VIEW
.
The intent used to start the activity can be retrieved with getContent()
. An intent can also be represented by an URI. This can be retrieved with getIntent().getData()
. The URI would look like this:
myscheme://app.custom.device.local/customer/102