Skip to main content

android - Phonegap onPause event was not working -


i have developed android app under phonegap. have used local notification plugin. trying notification server when app activity paused.

i tried in javascript:

document.addeventlistener("pause", onpause, false); function onpause() { // handle 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 generated", repeatdaily : false, id : 4//data.uid }); } } } }); } , 10000);} 

and in main activity :

@override public void onbackpressed() { movetasktoback(true); return; } } 

to pause event every time when button pressed.

but when app getting paused button/end call button/screen lock pause event not working. work 1 time.

what i'm missing?

android - phonegap onpause event not working - stack overflow

learn, share, build

each month, on 50 million developers come stack overflow learn, share knowledge, , build careers.

join world’s largest developer community.

sign up

i have developed android app under phonegap. have used local notification plugin. trying notification server when app activity paused.

i tried in javascript:

document.addeventlistener("pause", onpause, false); function onpause() { // handle 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 generated", repeatdaily : false, id : 4//data.uid }); } } } }); } , 10000);} 

and in main activity :

@override public void onbackpressed() { movetasktoback(true); return; } } 

to pause event every time when button pressed.

but when app getting paused button/end call button/screen lock pause event not working. work 1 time.

what i'm missing?

share|improve question

your answer

 
discard

posting answer, agree privacy policy , terms of service.

browse other questions tagged or ask own question.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -