【发布时间】:2016-06-06 08:48:29
【问题描述】:
当播放商店链接(在网页上)针对我的应用时,我正在尝试打开我的应用。我尝试了以下意图过滤器,但无法正常工作:
HTTPS 链接
<intent-filter>
<!-- Catch web intents for Google Play Store -->
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="play.google.com"/>
<!--<data android:path="/store/apps/details?id=my.app"/>-->
<data android:scheme="https"/>
<data android:scheme="http"/>
</intent-filter>
问题在于 Play 商店始终处于打开状态。我试图重置它的设置以删除“默认操作”,但没有运气。在浏览我的应用程序页面并单击地址栏中的小 Android 图标时,无论我是使用 ADB shell ($ am start -a android.intent.action.VIEW -d https://play.google.com/store/apps/details?id=my.app) 还是 Firefox 移动设备,我都有这种行为。使用该配置,我应该捕获所有 Play Store 意图(正如我评论路径),但事实并非如此。它是否覆盖了选择器对话框?
市场链接
<intent-filter>
<!-- Catch Google Play Store intents for FB Messenger -->
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="market"/>
<data android:host="details"/>
</intent-filter>
对于第二个意图,我成功地抓住了它,但我找不到一种方法让它特定于我的应用程序。我试图与其他领域一起玩,但没有运气。 ($ am start -a android.intent.action.VIEW -d market://details?id=my.app)
所以最后,我的问题是:“如何从针对包 my.app 的网页中拦截所有 'Open play store' 意图,无论是 market://details... 还是 https://play.google.com... URI?”
【问题讨论】:
标签: android intentfilter