做一個需求,要在手機瀏覽器里面喚起APP,當沒有安裝APP的時候跳轉到下載頁面。
當設定:scheme為:myAPP的時候,HTML對應的為:<a href="myapp://jp.app/openwith?name=zhangsan&age=26">invoke app</a>,這是可以正常呼叫起來的。
<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:scheme="myapp" android:host="kggl.adj.st"/>
</intent-filter>
但是問題來了,當schme設定為:http的時候,HTML對應的為:<a href="http://uyilive.com/">invoke app</a>,就無論如何也呼叫不起來了,只會去打開網頁,無論有沒有安裝APP都是呼叫不成功的。
<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:scheme="https" android:host="kggl.adj.st"/>
</intent-filter>
希望有大佬告訴小弟
uj5u.com熱心網友回復:
這不是很正常嗎?瀏覽器本身自己就是處理這種scheme的,再說你為什么一定要用http作為scheme呢uj5u.com熱心網友回復:
如果非要實作這種邏輯,你可以讓前端做個判斷,首先嘗試打開你定的myapp://jp.app/openwith?name=zhangsan&age=26,如果超時(時間0.5s或者更長,你自己定)就轉為打開http連接轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/122028.html
標籤:Android
下一篇:c語言
