Android Intents with Chrome
阿新 • • 發佈:2018-12-23
接著上一篇 LINE 貼圖網址傳回的資料分析 ,接下來要在 Android 的 WebView 裡開啟我們的App 或讓使用著去 Google Play Store 下載 App.
LINE 的使用範例:
Google 官方的使用範例:
Here’s an intent that launches the Zxing barcode scanner app. It follows the syntax thus:
intent:
//scan/
#Intent;
package=com.google.zxing.client.android;
scheme=zxing;
end;
To launch the Zxing barcode scanner app, you encode your href
<a href="intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;end"> Take a QR code </a>
See the Android Zxing Manifest, which defines the package and the host.
Also, if fallback URL is specified, the full URL will look like this:
<a href="intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;S.browser_fallback_url=http%3A%2F%2Fzxing.org;end"> Take a QR code </a>
Now the URL will get you to zxing.org if the app could not be found, or the link was triggered from JavaScript without user gesture (or for other cases where we don’t launch an external application.)