i developed app client in user can set local notifications. issue when user tries delete alarm/notification list, notification still fires (for repeating alarms). i've tried cancel notifications on load , setting each 1 notification again other methods, nothing seems work. there solution this? has else experienced this? should pretty basic task accomplish.
here's code i'm using remove notification server db within phone's local notification storage:
tbl.addeventlistener('delete',function(e){ var rowindex = e.rowindex; tbl.deleterow(rowindex); var appreq = ti.network.createhttpclient(); appreq.open('post', app.appurl + 'actions.php'); //load appreq.onload = function(){ ti.api.info(this.responsetext); var appresp = json.parse(this.responsetext);//json resp if(appresp.rsp == 'ok') { app.alarms[e.rowdata.cancel_id].cancel(); view.getalarms(); }else { alert(appresp.msg); } }; //error appreq.onerror = function(e){ ti.api.info(e.error); }; //data var data = { id:e.rowdata.id, action:'removealarm' }; //send ti.api.info('sending: ' + json.stringify(data)); appreq.send(data); });
**note: code seemed work device not client's, need make sure proper method.
to cancel pending notifications, call ti.app.ios.cancelalllocalnotifications()
method.
Comments
Post a Comment