Android 用于从web链接到应用程序的http方案意图筛选器
这似乎是一个典型的问题,似乎有很多不同的行为,但我遇到的问题是,我的方案将启动选择器,并允许我在点击电子邮件中的链接或设备上的便笺时选择我的应用程序,但如果我点击网页上的链接,我似乎无法启动应用程序,甚至不要让选择器,我已经检查了两个浏览器的默认值,没有设置Android 用于从web链接到应用程序的http方案意图筛选器,android,android-intent,intentfilter,Android,Android Intent,Intentfilter,这似乎是一个典型的问题,似乎有很多不同的行为,但我遇到的问题是,我的方案将启动选择器,并允许我在点击电子邮件中的链接或设备上的便笺时选择我的应用程序,但如果我点击网页上的链接,我似乎无法启动应用程序,甚至不要让选择器,我已经检查了两个浏览器的默认值,没有设置 <activity android:name=".MyActivity" android:exported="true" android
<activity
android:name=".MyActivity"
android:exported="true"
android:enabled="true">
<intent-filter>
<data android:scheme="http" android:host="www.website.com"/>
<data android:scheme="http" android:host="website.com"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
使用Chrome和stock浏览器在运行ICS4.0.3的GS2上进行测试。添加android:pathPrefix属性
<data android:scheme="http" android:host="website.com" android:pathPrefix="/" />
添加android:pathPrefix属性
<data android:scheme="http" android:host="website.com" android:pathPrefix="/" />
我最终就是这样解决的:
<intent-filter>
<data
android:host="www.website.com"
android:pathPattern=".*\\share.aspx"
android:scheme="http" />
<data
android:host="website.com"
android:pathPattern=".*\\share.aspx"
android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
有两个地址的原因是,应用程序可以在有/没有www的情况下获取规范域。这就是我最终解决问题的方法:
<intent-filter>
<data
android:host="www.website.com"
android:pathPattern=".*\\share.aspx"
android:scheme="http" />
<data
android:host="website.com"
android:pathPattern=".*\\share.aspx"
android:scheme="http" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
有两个地址的原因是,应用程序可以在有/没有www的情况下获取规范域。我在nexus 7和galaxy nexus上的chrome on jellybean上也遇到了同样的问题。意图是从gmail应用程序发送的,但不是从chrome浏览器或galaxy nexus中的传统浏览器发送的。我在nexus 7和galaxy nexus上的chrome on jellybean中也遇到了同样的问题。该意向是通过gmail应用程序发送的,但不是通过chrome浏览器或galaxy nexus中的传统浏览器。