当用户访问网站时,我尝试从浏览器启动一个 Activity (仅显示警告图标),但是当我将 Intent 过滤器添加到 AndroidManifest.xml 时,应用程序永远不会在加载时启动新 Activity 网址。
加载的唯一方式是如果它是 URL 的链接(例如在电子邮件中),而不是当用户实际拉起 www.playboy.com 时
有什么建议吗?
- 阿玛尼
list
<activity
android:name="com.app.Warning"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="playboy.com" android:scheme="http"></data>
</intent-filter>
</activity>
最佳答案
如有疑问,请复制 Google。 Play 商店和 YouTube 应用程序都在其 Intent 过滤器中使用某种路径规范。尝试类似 pathPrefix="/"
。
Google Play 商店的 list 包含以下行:
<data android:scheme="http" android:host="market.android.com" android:pathPrefix="/" />
关于java - 通过 Intent 查看器和浏览器地址栏启动 Activity - 没有任何反应 - 仅在单击链接时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15639921/