2

我已經實現深層鏈接在我的清單文件,應用程序,我有定義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://stackoverflow.com/a/39486914/1293313但沒有運氣

,並在Android中7.1.1藉助應用安裝

HTTPS方案 - URL打開應用程序和工作完美 http方案 - URL打開應用程序和工作完美(編輯)

回答

0

首先檢查鏈路是由亞行或不可到達,通過使用:

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>

相關問題