我在我的應用中使用了應用索引,但有時它無法正確接收來自Chrome的意圖。Android深層鏈接僅在某些網站中工作
如果我從我的製作網站打開鏈接,它會通過chrome打開。所以我創建了一個具有相同代碼的測試網站。但是,在這種情況下,我的應用程序正確打開深層鏈接。
我找不到任何解釋,因爲它在網絡(但在不同的網站)和相同的Android應用程序中使用相同的代碼。
這是我的意圖過濾器:
<intent-filter android:autoVerify="true">
<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="soriabus-web.appspot.com" android:pathPrefix="/" />
</intent-filter>
這是我的按鈕的HTML代碼:
<a href="https://soriabus-web.appspot.com/parada/1/plaza-mariano-granados/true"
"type="button"
role="button"
class="btn btn-primary">
Abrir Soria Bus
</a>
如果我打開這個地址(生產)的鏈接,它會打開Play商店(鏈接的到底是重定向到谷歌播放):
https://soriabus-web.appspot.com/parada/1/plaza-mariano-granados
如果我打開這個地址等(測試)的鏈接,它會打開我的應用程序correclty:
https://central-splice-128620.appspot.com/parada/1/plaza-mariano-granados
我不明白爲什麼鏈接的處理differenty。謝謝。
編輯:
難道是因爲我下面同一站點內的鏈接嗎?
https://soriabus-web.appspot.com/parada/1/plaza-mariano-granados => https://soriabus-web.appspot.com/parada/1/plaza-mariano-granados/playstore
Chrome不是Android的默認瀏覽器嗎? –
或者我可以將我的問題重新分配爲「如果我的操作正在按下按鈕,爲什麼我的情況與鍵入url相同?」 –
@JavierDelgado對不起,它命名爲Android瀏覽器,Android 4.2之前的默認瀏覽器,我在我的答案中編輯了這部分內容。你可以試試我提到的「意圖」方式嗎? – xfdai