forked from phonegap/phonegap
-
Notifications
You must be signed in to change notification settings - Fork 0
Back Button Usage
mwbrooks edited this page Jul 31, 2012
·
1 revision
// 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!');
}
// 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!');
}
If you have the problem, that back button always exits the app after firing the event, add the following to your AndroidManifest.xml:
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15" />