我正在使用構建變體,並希望捕獲基於變體的其他鏈接。我希望所有的變體捕獲來自主機的一個環節,所以我已經宣佈了intent-filter
在我的主AndroidManifest.xml
文件像這樣:Android應用鏈接多個意圖過濾器主機和清單合併不工作
<activity android:name=".activity.DeepLinkActivity"
android:noHistory="true">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:host="hostOne.com" android:path="/page.aspx" android:scheme="http"/>
</intent-filter>
</activity>
我也產生了其他變體的部分清單,如hostTwo.com像這樣:
<?xml version="1.0" encoding="UTF-8"?><manifest package="com.package.my.domain">
<application xmlns:android="http://schemas.android.com/apk/res/android" android:name="AlarmMobile">
<activity android:name=".activity.DeepLinkActivity">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="http://" android:host="hostTwo.com" android:path="/page.aspx"/>
</intent-filter>
</activity>
</application>
</manifest>
它是根據在構建變種(based upon the documentation here)和Android工作室的合併清單視圖放置在適當命名的文件夾顯示,intent-filter
用於主機2已被加入到最終的合併清單,但是,模擬器或實際設備發生故障捕捉意圖的意圖e第二主機。
我生成的意圖,像這樣在命令提示符:
adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "http://hostone.com/page.aspx"
該協會致力於hostone,但這樣做
,因爲應用程序無法捕捉到它會啓動瀏覽器。
做的Android應用程序鏈接只適用於一個主機名?還有什麼我可以嘗試的嗎?
檢查所生成的AndroidManifest文件(在Android Studio中打開apk文件) –
'主機= 「hostOne.com」'' 主機= 「hostTwo」' 莫非此差小成爲問題?(您錯過.com)在我的情況下,我使用了一個針對不同主機的兩個意向過濾器。 – Michael
@Michael在我編輯出所用的實際網站時出現了錯誤:)如果將所有數據標記放在一個意圖過濾器聲明中,我可以在部分聲明中做到這一點,但我會而不是我不必爲每個風味/變體組合生成一個組合 –