Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

How to trigger the call back function only notification receive

$
0
0

Hi i am using the below code on each login to manage different push user for our app iam getting the push messages with out issues. The issue is while i logged out from the app along with push users and unsubscribe function. and try to login again the last send push is triggering again at fist time .please help me to solve this issue.

Titanium.Network.registerForPushNotifications({ types: [ Titanium.Network.NOTIFICATION_TYPE_BADGE, Titanium.Network.NOTIFICATION_TYPE_ALERT, Titanium.Network.NOTIFICATION_TYPE_SOUND ], success:function(e) { deviceToken = e.deviceToken;

},
error:function(e)
{
    alert("Error: "+e.message);
  // Ti.API.info("Error: "+e.message);
},
callback:function(e)
{

alert("push notification received"+JSON.stringify(e.data)) });

This is function is used to clear the push sessions

function llout(){

Cloud.PushNotifications.unsubscribe({ channel: 'demo_alert', device_token: deviceToken }, function (e) { if (e.success) {

Cloud.Users.logout(function (e) {
if (e.success) {
    alert('Success: Logged out'+JSON.stringify(e));
} else {
    alert('Error:\n' +
        ((e.error && e.message) || JSON.stringify(e)));
}
});


} else {
 //   alert('Error:\n' + ((e.error && e.message) || JSON.stringify(e)));
}

});

}


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>