2015-12-11 123 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

相关问题