I was wondering how I'd have to configure my app to open it with android-app://application.id
?
adb shell am start android-app://application.id
The URI_ANDROID_APP_SCHEME seems not to work as documented. Instead Chrome and Firefox only open a market://
link to my app.
For Chrome I found a documentation only describing the intent://
scheme.
When the intent filter contains the DEFAULT
and BROWSABLE
category it works with Firefox.
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
You have to add <data../>
describing URI in intent-filter
for your component, like so,
<intent-filter>
...
<data android:scheme="android-app"/>
</intent-filter>
and on your site part define intent like this
intent:#Intent;scheme=android-app;package=your_package;end
UPDATE. Didn't realize that scheme was a reserved one, although my solution works for any scheme you define. I looked up the sources of the Intent class it seems you have to define your URI like this
android-app://your_package
OR
android-app://your_package/
#Intent;action=com.example.MY_ACTION;end
First line of the parseUri
method in the Androids Intent class
final boolean androidApp = uri.startsWith("android-app:");
Worth to mention: This scheme was added on API 22.
I've tested it works with a
tag, and as @tynn mentioned in the comments also for window.open()
and location.href
and not working from the address bar in Chrome.