Reputation: 1541
I am creating an android APP using Ionic framework,I want to launch an external app from my app.
I included the acces-orgin in the config.xml
<access origin="speedtest:*" launch-external="yes"/>
I am using the following code
<button class="button button-positive" ng-click="btnClick()"> Launch Speed Test</button>
In My 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');
}
);
}
}
the following line is not working and it does not throw any error in the console.
window.open('speedtest://', '_system', 'location=no');
Please guide me .
Upvotes: 2
Views: 3708
Reputation:
You can start an external application using third party plugin. Please follow the link below
Plugin for check or launch other application in android device
e.g.
Check application for installed
navigator.startApp.check("com.application.name", function(message) { /* success */
console.log(message); // => OK
},
function(error) { /* error */
console.log(error);
});
Start external application
navigator.startApp.start("com.application.name", function(message) { /* success */
console.log(message); // => OK
},
function(error) { /* error */
console.log(error);
});
Upvotes: 1