How to create Android Back Button handler:
phonegap 0.9.5 and later:
// This is your app's init method. Here's an example of how to use it
function init() {
document.addEventListener("deviceready", onDR, false);
}
function onDR(){
document.addEventListener("backbutton", backKeyDown, true);
//boot your app...
}
function backKeyDown() {
// do something here if you wish
// alert('go back!');
}
phonegap 0.9.4 and earlier:
// This is your app's init method. Here's an example of how to use it
function init() {
document.addEventListener("deviceready", onDR, false);
}
function onDR(){
BackButton.override();
document.addEventListener("backKeyDown", backKeyDown, true);
//boot your app...
}
function backKeyDown() {
// do something here if you wish
// alert('go back!');
}