0

I was trying to create some web app using Framework 7. Everything's fine, but i'd like to be able to call an app from the Home Screen (for example, the Store or the News app).

I know that some APIs are published by Apple Inc, but I can't find a way to call an app from my PHP code.

The Web app is created to run in Safari.

I tried something like:

<script type="text/javascript" charset="utf-8">

                window.location = "myapp://iMessage";

    </script>

But it doesn't seem to be able to launch the app.

C-Cat
  • 13
  • 5
  • I'm no expert on opening apps from JS, but it seems that `myapp` should be a scheme registered in your app and there should be path/parameters after `//`. Also, if you want to open `iMessage` specifically, this may be a place to look at : https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/SMSLinks/SMSLinks.html – Losiowaty Jan 12 '16 at 18:07
  • No. I just wanna open any app from Home Screen and I simply need a call code like me.open(Safari) – C-Cat Jan 12 '16 at 18:13
  • "Any" meaning "any one will do" or meaning "the possibility to open each app present on home screen"? – Losiowaty Jan 12 '16 at 18:16
  • My question is a general one. Let's take an example, I wanna call the News App. I need the actual api to open one of the installed apps, no matter which of them. – C-Cat Jan 12 '16 at 18:25

2 Answers2

1

Before iOS 9

In order to open another app in iOS you need to know what schemes it supports. Not all apps use them, so not every app is openable this way. An example scheme that opens up AppStore looks like this :

itms://itunes.apple.com/us/app/apple-store/id375380948?mt=8

This will open AppStore on "Apple Store" apps screen. You can test this also by replacing itms with https and pasting in your browser. The itms part is the scheme, and the rest are the parameters passed to the app.

Since iOS9

Apps can register to handle "generic" URLS, so a URL like http://9gag.com/gag/a1MXxR2 will be opened in 9GAG app (unless the user doesn't agree to it - he will be asked the first time he opens such a link in Safari, then it will be opened in Safari).

Note that not all apps support it yet, and there is no way (apart from asking the creators) to know if they ever will.


So to answer your question : there is no generic way to open a "random" app installed on someones phone. Especially not apps which don't support such opening via URLs (no matter whether with a custom scheme, or http(s)).

Some of the popular apps (Facebook, Twitter, Chrome, ...) publish their schemes and you can implement them, not all will do so.

Note: this all applies to non-jailbroken phones.

Community
  • 1
  • 1
Losiowaty
  • 7,911
  • 2
  • 32
  • 47
0

There's not a general purpose way to open any app. Opening a specific app requires that:

  1. that app has registered to respond to a specific URL scheme (e.g. instagram://)
  2. you know what the URL scheme is. Sometimes an app's URL scheme isn't publicly available.

I think "myapp://" scheme you're using was someone's example but doesn't apply to all apps.

Devin Pitcher
  • 2,562
  • 1
  • 18
  • 11