简体   繁体   中英

titanium appcelerator cloudpush tray notification not showing

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM