深层链接无法打开应用程序
问题描述:
我已经实现深层链接在我的清单文件,应用程序,我有定义intent-filter
这样深层链接无法打开应用程序
<activity
android:name=".activity.ProfilePreviewActivity"
android:theme="@style/AppTheme.ActionBar.Transparent">
<intent-filter android:autoVerify="true" android:label="@string/app_name"
tools:targetApi="m">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:host="appsdata2.cloudapp.net"
android:scheme="https"
/>
</intent-filter>
<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:host="appsdata2.cloudapp.net"
android:scheme="http"
/>
</intent-filter>
</activity>
现在的问题是:
我定义这两个方案,并还增加了android:autoVerify="true"
在安卓6.0.1借助应用安装
HTTPS方案 - URL打开应用程序和工作完美
http scheme - url打开浏览器不是真正的应用程序?我错过了什么吗?
我跟着https://*.com/a/39486914/1293313但没有运气
,并在Android中7.1.1借助应用安装
HTTPS方案 - URL打开应用程序和工作完美 http方案 - URL打开应用程序和工作完美(编辑)
答
首先检查链路是由亚行或不可到达,通过使用:
adb shell am start -n com.example.simon.test/.activity.ProfilePreviewActivity
只需在代码下面尝试一下,因为Chrome在打开链接时存在一些问题。
<activity
android:name=".activity.ProfilePreviewActivity"
android:theme="@style/AppTheme.ActionBar.Transparent">
<!-- For chrome links -->
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="appsdata2.cloudapp.net"
android:scheme="http"
android:pathPrefix="/"/>
</intent-filter>
<!-- For adb -->
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="appsdata2.cloudapp.net"
android:scheme="http"/>
</intent-filter>
</activity>
尝试测试的链路构成的浏览器<a href="http://appsdata2.cloudapp.net"></a>