【发布时间】:2016-04-07 15:22:11
【问题描述】:
我正在使用 Ionic 框架创建一个 android 应用程序,我想从我的应用程序启动一个外部应用程序。
我在 config.xml 中包含了 access-orgin
<access origin="speedtest:*" launch-external="yes"/>
我正在使用以下代码
<button class="button button-positive" ng-click="btnClick()"> Launch Speed Test</button>
在我的 app.js 中
function onDeviceReady() {
var scheme;
// Don't forget to add the org.apache.cordova.device plugin!
if(device.platform === 'iOS') {
scheme = 'speedtest://';
}
else if(device.platform === 'Android') {
scheme = 'org.zwanoo.android.speedtest';
}
$scope.btnClick = function() {
appAvailability.check(
scheme, // URI Scheme
function() { // Success callback
window.open('speedtest://', '_system', 'location=no');
console.log('Speedtest is available');
},
function() { // Error callback
//alert("not available");
window.open('https://play.google.com/store/apps/details?id=org.zwanoo.android.speedtest', '_system', 'location=no');
console.log('Speedtest is not available');
}
);
}
}
以下行不起作用,它不会在控制台中引发任何错误。
window.open('speedtest://', '_system', 'location=no');
请指导我。
【问题讨论】:
标签: android cordova ionic-framework phonegap-plugins