2015-12-11 122 views
-1

我們是否可以在沒有網站的情況下實現移動應用程序的深層鏈接,或者我們是否必須具有預定義的特定網站才能實現?深度鏈接到Android應用程序

+0

利用亞行。 $ adb shell am start -W -a android.intent.action.VIEW -d

回答

1

深層鏈接可以在沒有特定網站的情況下運行。您需要的所有工作是通過AndroidManifest將<intent-filter> ... </intent-filter>標記添加到您的首選活動。

然後創建一個唯一的URI模式,用於匹配任何HTTP URI,例如http://your-app-domain/content或自定義方案,如your-app://content。將此方案添加到<data ... />標記。

以下是完成後您的活動應該是什麼樣子。

<activity 
      android:name=".activities.DeepLinkingActivity" 
      android:label="@string/title_activity_deeplink"> 

      <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="your-app-domain" 
        android:pathPrefix="/content" 
        android:scheme="http" /> 

      </intent-filter> 
     </activity> 

不管您選擇的URI方案如何,當觸發方案的意圖時,您應該能夠開始您的活動。

如果您熟悉亞行命令,輸入此命令

adb shell am start -a android.intent.action.VIEW -d "http://your-app-domain/content" com.your-app-package 

進一步閱讀的終端https://developers.google.com/app-indexing/android/app

相關問題