Jay Patel
Jay Patel

Reputation: 5793

App Store/Play Store redirection if App is not installed on ionic App

I have implemented deeplink for my ionic v1 application and also implemented universal link for same. I also checked so many links to implement App store redirection functionality.

Most of the link suggest to implement javascript code which first check device and based on ios/adnroid/window it will redirect to particular store but let say I will create that javascript code look like below

const iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);

if (iOS) {
  window.location.href = "temp://itunes.apple.com/us/app/...";
}

but where should I put this file so when user click on deeplink it should redirect to particular this file and redirect to App Store/Play Store?

Let say I want to give my deeplink to some other server for which i don't have any access then what?

is there any other param or attribute we can set like fallback url by which when app is not installed it will automatically going to that particular link?

Any answer would be great help.

Thanks.

Upvotes: 0

Views: 1942

Answers (1)

Dror Davidi
Dror Davidi

Reputation: 351

Usually it works that way:

  1. You place a link on the website where you want to advertise your app. That link has a click tracking domain that points to your server. e.g. click.example.com/....
  2. Upon clicking, if the app is installed, Universal Links would ensure that the app is opened. This is done by iOS (only if you configured Universal Links correctly, see https://developer.apple.com/ios/universal-links/). If the app is not installed, a redirect is done to your click tracking domain. This is where your Javascript logics should apply, so basically you need to reply to the request with a 302 redirect to an HTML file that contains the redirection logics (as in the example above). In that server response you can handle any fallback URL you want to use.

By the way, to make Universal Links work, anyway you had to host the AASA file, so you probably already created a server, so you can use it for the case where the app is not installed.

Upvotes: 1

Related Questions