I’m trying to develop an android app with phonegap and LocalNotification plugin.
I want to running my app in onPause ,
On my index.html
document.addEventListener("pause", onPause, false);
function onPause() {
// Handle the pause event
setInterval( function() {
Ext.data.JsonP.request({
url: 'http://convert4mobile.net/backend/API/qr/push.php',
callbackKey: 'callback',
success: function(data)
{
if(data.success == true)
{
if (typeof plugins !== "undefined") {
window.plugins.localNotification.add({
date : new Date(),
message : data.time+"\r\n"+data.msg,
ticker : "A new code was generated",
repeatDaily : false,
id : 4
});
}
}
}
});
} , 2000);
}
It works fine when the app was closed/minimized by home button/end call button.
I want to do the same thing by BackButton tapping.
Any idea??
Enter whatever code you want in this method:
Tutorial Here: http://chrisrisner.com/31-Days-of-Android–Day-10%E2%80%93The-Back-Button