EddyVerbruggen / Custom-URL-scheme

:link: Launch your Cordova/PhoneGap app by a Custom URL scheme like mycoolapp://
1.03k stars 367 forks source link

If the app is not installed redirect to Apple store or Google Play #195

Open kodatech opened 8 years ago

kodatech commented 8 years ago

Hi there,

I've a problem to detect if the app is installed or not from my website. The configuration is one website that connects with the app, but if the app is not installed should be good if the website redirect to apple store or google play.

The solution I found is with setInterval but it is not a good one because the web page always ends in the stores.

Any of you solve this issue?

kodatech commented 8 years ago

Hi there,

I think I find the solution. From the website I call the app using a location.href, if the app is not installed it returns the address of the web. The solution: redirect to website/home always and if /home is not present goes to the play store or app store.

var dispositivo = navigator.userAgent.toLowerCase(); if( dispositivo.search(/android/) > -1 ){ var aux=location.href; location.href='scan://?path='+aux+''; if (location.href=="http://www.xxx.co.nz/"){ location.href="https://play.google.com/store/apps/details?id=com.phonegap.ryanw.barcode"; } }

sachinjain1 commented 6 years ago

i am having a issue, in which i am sending a url to the user where user clicks on url then it gets redirect to app and if app is not installed it will redirect to the play store, i am using ionic3,

but the problem is that only on the base of Sms url how can i redirect to the play store

on the app it is redirecting sucessfully..

thank you