android - 使用 Ionic 在 Android/iOS 上执行外部应用程序

标签 android ios angularjs ionic-framework uri

在我的 Ionic 应用程序中,我尝试仅在每次单击按钮时执行各种应用程序。以下函数在 Android 和 iOS 上启动 Skype。 Android 版 Skype 的 URI 是 com.skype.raider,iOS 版是 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!");
    });
}

重要的是找到各个应用程序的 Intent 链接 (URI) 并在 Android/iOS 上运行这些应用程序。 我很难找到 iOS 的 URI 链接。在 Android 上,很容易找到。在 Google Play 上,可在地址栏中找到相应的 App ID。

我的问题是,在哪里可以找到要启动的 iOS 应用程序的应用程序 ID?我将为其他应用程序开发相同的功能。我只需要 ID。

我需要例如这些( native )应用程序的 ID 来执行:

  1. native “电子邮件应用”(Android/iOS)的 URI
  2. native “地址簿”(Android/iOS)的 URI
  3. native “我的文档”(Android/iOS)的 URI

编辑:

所以,我找到了一个名为 Package Name Viewer 的 android 应用程序,它给出了所有已安装应用程序的包名称。 iOS有类似的东西吗?通过该应用程序,我找到了以下包名称:

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

第二点,com.android.contacts 不会直接显示给 Android 上的联系人。哪个链接显示设备上直接存储的联系人是正确的?

最佳答案

iOS 不允许这种行为。已经有人努力试图规避这一点,并且根据 this stackoverflow answer [1] 你可以直接试试URI能不能打开

引用自其他答案:

  • 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.

关于android - 使用 Ionic 在 Android/iOS 上执行外部应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32580579/

相关文章:

android - 如何在不删除以前版本生成的数据的情况下安装 AIR android 应用程序

java - IP改变时广播事件?

android - 频繁的http请求

ios - 警告 : Unexpected type for now playing key kMRMediaRemoteNowPlayingInfoDuration

angularjs - 如何在 popover 中使用 AngualarJs ng-grid 或 ui-calendar

css - 单击以缩放使用 ng-repeat 创建的 div

javascript - 移动设备的 jQuery click 替代品

ios - Sprite 离开屏幕边界

javascript - 在 md-autocomplete 上使用 ng-blur?

ios - 你如何在 iOS 应用程序中绘制曲线路径,类似于它们在寻宝 map 上显示的路径