Tuesday, 12 March 2013

Android Back button Issue Fixed in phonegap

     Android Back button Issue Fixed in phonegap 



I have fixed android back button issue below

In my application my using this cycle index.html page user can defined device Type. Initial page index.html .after go to home.html. so we put device Type defined In example.js and that page we defined back button function also. Example
Function init() // device Type defined
{
// device type defined code
}


// back button for android device
function onload() { // onload function cal to home and em.html page
    try {
        document.addEventListener("deviceready", onDR, false);
    }
    catch (ex) {
    }
}
function onDR() {
    document.addEventListener("backbutton", backKeyDown, true);

}
function backKeyDown() {
alert(‘go back’);
        navigator.app.exitApp();
}

This is the important part
Device type function call to index.html page body <body onlaod=”init()”>
And back button onload function call to home.html page body <body onlaod=”onload()”>


if any query plz chat with me christopher.jul@gmail.com

No comments:

Post a Comment