android - Titanium Appcelerator push notification callback called more than once -
I have been able to register mobile devices and subscribe to a channel in titanium. When the mobile device receives 2 push notifications and the user clicks on any of them
Callback is called twice How do I know which notification was clicked on Was or did I know that the total number of push notifications is pending? and , Function (evt)) {var title = JSON.parse (evt.payload);});}); Just implement the function like this: < Pre> How will I know which notification was clicked on? Answer : You can see the badge number in response to push notification, inside the callback function and depending on it, you can control that it was clicked. Or pending status Hope it helps.
var needs cloudpipe = ('Clappash'); //CloudPush.singleCallback = True; // Start the module cloud pipe. RetrieveVisionCon ({Success: DeviceTokel Security, Error: DeviceTrackerError}); // Enable push notifications for this device // Save device token for later API call function DeviceToolSoot (E) {//CloudPush.enabled = true; Device Tokens = E.Device Talk; subscribeToChannel (); // sendTestNotification (); } Function deviceTokenError (e) {// warning ('Failed to register for push notifications!' + E. terror); } // trigger when the push notifications are in the tray, when app cloudPush.addEventListener ('trayClickLaunchedApp', function (evt) {CloudPush.addEventListener ('callback', function (evt) is not running {var title = JSON.parse (Evt.payload);});}); // Trigger When Push Notifications are in the tray, when App CloudPush.AdventListner ('Treklichickis app', function (avt)) is run, then CloudPush.AdventAlliston ('callback', function (avt) {var title = JSON Parse (evt) .payload);});}); Var cloud = ("Claude"); Function subscribeToChannel () {// 'test' channel // subscribe for the device // Specify push type for Android as 'Android' or 'iOS' IOS / alert (deviceToken + "ss"); Titanium. App.Properties.setString ("Token", DeviceToken); Cloud.PushNotifications.subscribeToken ({device_token: deviceToken, channel: 'test', type: Ti.Platform.name == 'android'? 'Android': 'ios'}, function (e) {if (e.success) {// Alert ('Subscribed');} and {Warning ('Error: \ n' + ((Err & amp; AM) || JSN Stringuef (E)));}}); }
callback is called twice because you apply callback Inside the function:
CloudPush.addEventListener ('trayClickLaunchedApp', function (evt) {CloudPush.addEventListener ('callback', function (evt) {var title = JSON.parse ( CloudPush.addEventListener ('trayClickFocusedApp', function (evt) {CloudPush.addEventListener ('callback');
CloudPush AddEventListener ('callback', function (evt) {var title = JSON.parse (evt.payload);}); CloudPush.addEventListener ('trayClickLaunchedApp', function (evt) {Ti.API.info ('click tray application launches (app was not running) ');}); CloudPush.Adent Listener (' tricklefoccinside app ', function (EVT) {TI.P.I.INFO (' tray click focus app (app was already running ');});
Comments
Post a Comment