Android PhoneGap询问您是否要退出或返回历史记录
这是我的代码:Android PhoneGap询问您是否要退出或返回历史记录,android,cordova,back-button,Android,Cordova,Back Button,这是我的代码: function onLoad(){ alert("onLoad"); document.addEventListener("deviceready",onDeviceReady, true); } function onDeviceReady(){ navigator.notification.alert("PhoneGap
function onLoad(){
alert("onLoad");
document.addEventListener("deviceready",onDeviceReady, true);
}
function onDeviceReady(){
navigator.notification.alert("PhoneGap is working!!");
document.addEventListener("backbutton", onBackKeyDown, false);
}
function onBackKeyDown(e) {
navigator.notification.alert("PhoneGap handle back button click!!!");
/* want you to go back???
if yes go back or exit app
*/
}
你能帮我做些什么吗
/* want you to go back???
if yes go back or exit app
*/
非常感谢。navigator.app.exitApp在iOS上不工作:
function showAlert() {
navigator.notification.confirm(
'Vuoi uscire dall\'applicazione?', // message
onConfirm, // callback to invoke with index of button pressed
'Chiudere?', // title
'Chiudi app,Annulla' // buttonLabels
);
}
function onConfirm(button) {
if(button==1)
navigator.app.exitApp();
}
希尔:
如果要处理主类中的后退按钮,可以使用use onBackPressed。