简体   繁体   中英

Ionic 3 Deeplinking - launch app from URL

I'm developing a cross platform app using Ionic and when trying to achieve deeplinking, I installed an Ionic Native plugin called Deeplinks

I ran these comands:

ionic cordova plugin add ionic-plugin-deeplinks --variable URL_SCHEME=roor --variable DEEPLINK_SCHEME=http --variable DEEPLINK_HOST=roor.com --variable ANDROID_PATH_PREFIX=/

npm install --save @ionic-native/deeplinks

For testing, I made a codepen and added the following html

<h3>
  <a href="roor://roor.com">scheme</a>
</h3>

<h3>
  <a href="http://www.roor.com">url</a>
</h3>

My app did launch when clicking on scheme but nothing happened when clicking on url .

How can I be able to open my app from a URL

I also found an article about deeplinking: https://blog.ionicframework.com/deeplinking-in-ionic-apps/

which states that

To configure iOS and Android, we need to enable Universal Links for iOS, and App Links for Android (6.0+). This process is primarily done on the server side of your website. You'll publish a specific json file for iOS and one for Android, ensure your site is using HTTPS, and then configure your app to open in response to links to that domain.

But I'm not sure about what json file I should publish to enable deeplinknig from a URL?

You have to publish the ./static/.well-known/assetlinks.json file to your server to work with android, and the ./static/.well-known/apple-app-site-association for iOS.

Their names are confusing DEEPLINK_SCHEME is for Universal/App Links over HTTPS, while URL_SCHEME is for the old custom schemes like myapp://

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM