I am trying to work with the back button with help from the PhoneGap Documentation and Override Android Backbutton behavior only works on the first page with PhoneGap.
My code:
<script>
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
alert("df");
console.log("PhoneGap Ready!");
document.addEventListener("backbutton", handleBackButton, false);
}
function handleBackButton() {
console.log("Back Button Pressed!");
alert("df");
}
</script>
But I get this error:
05-21 16:00:03.248: E/Web Console(1615): TypeError: Result of expression 'PhoneGap.fireDocumentEvent' [undefined] is not a function. at undefined:1