1

In iOS App, to launch an application from safari, the URL scheme is something like this, Launch App from URL
is it possible to re-direct URL to Appstore pointing to the App if the particular app is not installed in the device,
Basically what i am looking

  • If app is already installed then let it be launch from the URL "A"
  • if app is not installed let it point to app store and promot user to download app,

there are examples of how to link to app to app store, but not able to add condition in the js when to launch custom URL scheme if app is there, else launch app store.

Update :

the answer provided and in the comment take me to the page which says how to launch the app store with specific app that's secdonary requirement, initially i need to have some js code which can detect whether the device has an app specific to URL scheme if not then open the App Store app page

element

Community
  • 1
  • 1
Amitg2k12
  • 3,723
  • 9
  • 45
  • 92

1 Answers1

3

I'm not sure if you can check if a third party app is installed on your device by code. I think only when you know the url-scheme of this specific 3rd party app you can check by

BOOL canOpen = NO;
    canOpen = [[UIApplication sharedApplication] canOpenURL:url];
    if (canOpen) {
        [[UIApplication sharedApplication] openURL:url];
    } else {
[[UIApplication sharedApplication] openURL:@"itms://itunes.apple.com/us/app/mensa-essen/id742570910?ls=1&mt=8"]; }
Miralem Cebic
  • 1,266
  • 1
  • 15
  • 28
  • actually this is native code, i need equivalent in js, user will be on webpage and if app is there then launch if not then prompt user to install – Amitg2k12 Apr 28 '15 at 09:07
  • sorry, i thought you need native code. Have you see this [Possible Answer](http://stackoverflow.com/questions/13044805/how-to-check-if-an-app-is-installed-from-a-web-page-on-an-iphone) – Miralem Cebic Apr 28 '15 at 10:30
  • Although the question was for a JS equivalent, it helped me out as I needed native code and wasn't aware of the canOpenURL check. Thanks! – setzuiro Apr 07 '16 at 19:50