在我的 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 来执行:
- native “电子邮件应用”(Android/iOS)的 URI
- native “地址簿”(Android/iOS)的 URI
- native “我的文档”(Android/iOS)的 URI
编辑:
所以,我找到了一个名为 Package Name Viewer 的 android 应用程序,它给出了所有已安装应用程序的包名称。 iOS有类似的东西吗?通过该应用程序,我找到了以下包名称:
com.android.email
com.android.contacts
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/