2017-09-15 93 views
0

我遵循Deep Links to App Content的教程。android應用程序無法通過傳入鏈接啓動

但是我的應用程序無法攔截鏈接。該應用程序根本無法啓動。

這裏是我的Android清單的一部分:

<activity android:name=".MainActivity"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN"/> 
      <category android:name="android.intent.category.LAUNCHER"/> 
     </intent-filter> 

     <intent-filter > 
      <action android:name="android.intent.action.VIEW" /> 
      <category android:name="android.intent.category.DEFAULT" /> 
      <category android:name="android.intent.category.BROWSABLE" /> 
      <!-- Accepts URIs that begin with "http://www.example.com/gizmos」 --> 
      <data android:scheme="http" 
        android:host="www.example.com" 
        android:pathPrefix="/gizmos" /> 
      <!-- note that the leading "/" is required for pathPrefix--> 
     </intent-filter> 

    </activity> 

這裏是測試頁面的index.html我把我的Web服務器上。

<a id="applink1" href="http://www.example.com/gizmos/sss">  
Open Application</a>  

我試了幾個小時,仍然無法弄清楚爲什麼它不起作用。

PS:

如果我改變計劃,一些隨機的東西,它會工作。
但是我想攔截http鏈接。

我也試過改變動作,類別,數據的順序,它沒有區別。

回答

1

除了Android部分,您還需要驗證是否確實允許攔截提供該URL的Web服務器上給定URL的鏈接。爲此,您需要創建JSON文件並將其上傳到給定的URL(在.well-known/assetlinks.json之下),該URL包含有關您的應用的驗證信息,從而有效地允許您的應用攔截鏈接。

有關詳細信息,請參見https://developer.android.com/training/app-links/verify-site-associations.html

+0

對不起,我的疏忽。我正在一步一步地跟蹤。我認爲你的回答是正確的。但是測試它需要一些時間。我會在接受測試後儘快接受你的回答。 – AlexWei

相關問題