2016-11-14 9 views
0

私はnavigator.app.exitApp()を使いたいです。ダイアログボックスで私のcordovaアプリを終了します.iはまた、cordovaダイアログプラグインをインストールしました。navigator.app.exitApp();コードブラウザのダイアログプラグインを使用すると動作しません

これは私のコードです:

<script> 
    function onConfirm(buttonIndex) { 
alert('You selected button' + buttonIndex); 
} 


navigator.notification.confirm(
'Do you want to exit app?', // message 
onConfirm,   // callback to invoke with index of button pressed 
'Exit',   // title 
['Yes','No']  // buttonLabels 
); 


    onConfirm(buttonIndex) { 
if (buttonIndex==2){ 
navigator.app.exitApp(); 
} 
} 
</script> 


<button onclick="onConfirm(); return false;">Exit</button> 

しかし、それは動作しません。

どうすれば解決できますか?

ありがとうございました。

答えて

1

モフセンAlkはこれを試してみて、すでにチェックされ、それはそんなにあなたをworked.thank

<input type="button" value="exit" id="exit" onclick="payrent();" /> 

function payrent() { 
    navigator.notification.confirm(
     'You are about to leave this app and open your default web browser. Continue?', 
     payrent1, // <-- no brackets 
     'Leave App?', 
     ['Ok', 'Cancel'] 
    ); 
} 

function payrent1(buttonIndex) { 
    if (buttonIndex == 1) { 
     navigator.app.exitApp(); 
    } 
} 
+0

を進めています。 –

関連する問題