titanium appcelerator cloudpush tray notification not showing

408 views Asked by At

Iam developing an application that uses push notifications. Iam using ti.cloudpush module 3.2X and titanium sdk 3.2X When i tries to recieve notification it deos not showing on tray. I can read message inside application but it is not creating on notification tray. here is my sample code

var CloudPush = require('ti.cloudpush');
CloudPush.enabled = true;
    CloudPush.showTrayNotificationsWhenFocused = true;
    CloudPush.showTrayNotification = true;
    CloudPush.focusAppOnPush = false;
    CloudPush.retrieveDeviceToken({
        success : function deviceTokenSuccess(e) {
            alert('Device Token: ' + e.deviceToken);
            deviceToken = e.deviceToken;
        },
        error : function deviceTokenError(e) {
            alert('Failed to register for push! ' + e.error);
        }
    });
    CloudPush.addEventListener('callback', function(evt) {
        alert(evt.payload);
        //alert(JSON.stringify(evt.payload));
    });
    CloudPush.addEventListener('trayClickLaunchedApp', function(evt) {
        Ti.API.info('Tray Click Launched App (app was not running)');
    });
    CloudPush.addEventListener('trayClickFocusedApp', function(evt) {
        Ti.API.info('Tray Click Focused App (app was already running)');
    });

Thanks in advance

1

There are 1 answers

0
Michael On BEST ANSWER

Assuming you have set up the PushNotifications.subscribe correctly the default properties of this module are used until you set a property for the first time.

Because the properties are persisted to the device settings (via Titanium.App.Properties), the most recent value you set will always be used.

Do a Build > Clean to make sure you have not overwritten one of these properties by accident.

Then double check what they are set to with quick logging check - Ti.API.log(Ti.App.Properties.getString('oneofthecloudproperties');

You should then be able to see if it's an issue with the subscribe event or how you have set the push notification properties.