2016-04-07 16 views
1

Ionicフレームワークを使用してAndroid APPを作成しています。私のアプリから外部アプリを起動したいと思います。 Appから外部アプリを起動する

は私が

<access origin="speedtest:*" launch-external="yes"/> 

私は私の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'); 
      } 
     ); 
     } 

    } 

次の行では、次のコード

<button class="button button-positive" ng-click="btnClick()"> Launch Speed Test</button> 

を使用していますconfig.xmlのアクセスも-orginを含みます動作しておらず、コンソールにエラーがスローされません。

window.open('speedtest://', '_system', 'location=no'); 

私をご案内ください。

+0

トライホワイトリストの

チェックアプリケーション - https://cordova.apache.org/docs/en/latest/guide/appdev/whitelist/index .html –

答えて

0

サードパーティのプラグインを使用して外部アプリケーションを開始することができます。

Plugin for check or launch other application in android device

例えば、以下のリンクをたどってください。インストール

navigator.startApp.check("com.application.name", function(message) { /* success */ 
    console.log(message); // => OK 
}, 
function(error) { /* error */ 
    console.log(error); 
}); 

スタート外部アプリケーション

navigator.startApp.start("com.application.name", function(message) { /* success */ 
    console.log(message); // => OK 
}, 
function(error) { /* error */ 
    console.log(error); 
}); 
関連する問題