Android - DeepLink

Android - DeepLink

最近要使用deep link 

有使用到 Branch這個第三方工具

https://dashboard.branch.io

在原本的AndroidMainfest.xml的 <activity>改為

<activity
    android:name=".MainActivity"
    android:label="DeepLink測試"
    android:screenOrientation="portrait"
    android:theme="@style/act_theme"
    android:windowSoftInputMode="stateHidden">
    <intent-filter>
        <data android:scheme="schemeName" android:host="open" />
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="https" android:host="fbgm.app.link" android:pathPrefix="/PrefixName" />
    </intent-filter>
</activity>

需要改android:scheme及android:pathPrefix,就可以接收到相關的資料並做導APP或導URL的動作

跳出選擇應用程式,預設會是抓activity 的label為了讓跳出來選擇應用程式呈現的文字,是app應用程式的文字,需要加上以下這段

<intent-filter android:label="@string/app_name">

其它教學文章

http://search-codelabs.appspot.com/codelabs/android-deep-linking#1