so send push notifications using arrowdb , cloud service appcelerator. seems work , iphone gets notification. wonder if there easy way clear badge numer 0? needs reset @ arrowdb server (or apple) guess.
i want badge reset every time app opened.
what did adding resume listener in alloy.js
ti.app.addeventlistener("resumed", function(e){
in event listener first (to reset badge locally):
cloud.pushnotifications.resetbadge({ device_token: device_token }, function (e) { if (e.success) { ti.api.info('badge reset!'); } else { ti.api.error(e); } });
then send push clear badge on server sending push ourself:
var push_payload = { badge:0, sound:"", alert:"", title:"", message_text:"", push_type:"clear", from_user:alloy.globals.currentuser.id, vibrate:false }; cloud.pushnotifications.notify({ channel: 'private_message', payload: push_payload, to_ids: alloy.globals.currentuser.id }, function (e) { if (e.success) { ti.api.info('success sending push notification'); } else { ti.api.info('error sending push: '+((e.error && e.message) || json.stringify(e))); } });
the event listener seems called, , push sent. somehow badge still remains on iphone device... should differently?
did try ?
titanium.ui.ios.appbadge = 0