Android Intents with Chrome

接著上一篇 LINE 貼圖網址傳回的資料分析 ,接下來要在 Android 的 WebView 裡開啟我們的App 或讓使用著去 Google Play Store 下載 App.

資料來源:Android Intents with Chrome
https://developer.chrome.com/multidevice/android/intents

 

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 on the anchor as follows:

  <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.)

 


附註:如果你用的是 Cordova 請參考這一篇:
https://stackoverflow.max-everyday.com/2017/11/opening-links-from-cordova-app-in-external-app-facebook-twitter-or-browser-both-for-ios-and-android-ask-question/

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *