我想知道如何配置我的应用才能使用android-app://application.id
打开它?
adb shell am start android-app://application.id
a documentation似乎无法正常工作。相反,Chrome和Firefox仅打开指向我的应用的market://
链接。
对于Chrome,我发现in this image you can see the selected date仅描述了intent://
方案。
当意图过滤器包含DEFAULT
和BROWSABLE
类别时,它将与 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>
答案 0 :(得分:3)
您必须在<data../>
中为组件添加intent-filter
描述URI,
<intent-filter>
...
<data android:scheme="android-app"/>
</intent-filter>
并在您的网站部分定义这样的意图
intent:#Intent;scheme=android-app;package=your_package;end
更新。 尽管我的解决方案适用于您定义的任何方案,但并未意识到该方案是保留方案。 我查看了Intent类的来源,看来您必须像这样定义URI
android-app://your_package
OR
android-app://your_package/
#Intent;action=com.example.MY_ACTION;end
Androids Intent类中的parseUri
方法的第一行
final boolean androidApp = uri.startsWith("android-app:");
值得一提的是:此方案是在API 22上添加的。
我已经测试了它可以与a
标记一起使用,并且正如评论中提到的@tynn也适用于window.open()
和location.href
,并且无法从 Chrome中的地址栏。