2016-04-02 63 views
4

我想为我的应用程序设置应用程序链接,但仅限于它在某些路径上处于活动状态。换句话说,在我的清单:Android:应用程序链接 - 仅支持某些路径?

<intent-filter android:autoVerify="true"> 
<action android:name="android.intent.action.VIEW"/> 
<category android:name="android.intent.category.DEFAULT"/> 
<category android:name="android.intent.category.BROWSABLE" /> 
<data android:scheme="http" android:host="www.mydomain.com/[mypath]" /> 
<data android:scheme="https" android:host="www.mydomain.com/[mypath]" /> 
</intent-filter> 

我不想网址有我的域名,打开应用程序 - 他们可以在浏览器中正常开放。我只希望包含特定子路径的网址在应用中打开。这种模式是否允许,或者它是否适用于应用程序链接?

链接到开发者文档: http://developer.android.com/training/app-links/index.html

回答

4

你可以有特殊的路径,但你不能/不应该让他们追加到主机。

你应该有

<data android:scheme="https" android:host="www.mydomain.com" /> 

并从那里你可以使用android:路径安卓pathPattern或Android:pathPrefix创造特殊的图案。

例如,

<data android:scheme="https" android:host="www.google.com" android:path="/en/index.html"/> 

只会赶上网址 “https://www.google.com/en/index.html

相关问题