Ramosta
Ramosta

Reputation: 647

executing external apps on Android/iOS with Ionic

In my Ionic app I try to execute various apps just per button click. The following function launchs Skype on Android and iOS. The URI from Skype for Androis is com.skype.raider and for iOS is skype://

function launchSkype() {
    var scheme;

    if (device.platform === 'iOS') {
        scheme = 'skype://';
    } else if (device.platform === 'Android') {
        scheme = 'com.skype.raider';
    } else if (device.platform === 'wp') {
        scheme = 'skype:';
    } else if (device.platform === 'windows8') {
        scheme = 'skype:';
    }

    navigator.startApp.check(scheme, function(message) { /* success */
        navigator.startApp.start(scheme, function(message) {
        }, function(error) { /* error */
            alert("Skype could not be started!");
        });
    }, function(error) {
        alert("Skype is not installed!");
    });
}

It's important to find the Intent links (URI) of the respective applications and run these on Android/iOS. I have difficulties in finding the URI links of iOS. On Android, it is easy to find. On Google Play the respective App ID is to find in the address bar.

My question is, where can I find the app ids of iOS applications for launching? I'll have the same function exploited for other apps. I just need the ids.

I need eg for precisely the Ids of these (native) app for the execution:

  1. URI of native "Email app" (Android / iOS)
  2. URI of native "Address Book" (Android / iOS)
  3. URI of native "My Documents" (Android / iOS)

Edit:

So, i find a app for android named Package Name Viewer which give the package name of all installed apps. Is there something similar for iOS? With the app I have found the following package name:

  1. com.android.email
  2. com.android.contacts
  3. com.sec.android.app.myfiles

The second point, so com.android.contacts doesn't show directly to the contacts on Android. Which link would be correct that displays directly stored contacts on the device?

Upvotes: 1

Views: 1440

Answers (1)

eikooc
eikooc

Reputation: 2553

iOS does not allow this behaviour. There has been efforts to try to circumvent this, and as according to this stackoverflow answer[1] you can just try to see if the URI can be opened

Cited from the other answer:

  • if the app is known to handle URLs of a certain type
  • by using [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"thisapp://foo"]

You can get a list of apps and URL schemes from here.

Upvotes: 1

Related Questions