All my notifications collapse into one on Android

Comments

5 comments

  • Avatar
    elpetro

    Hi, I expected a quick and easy reply for that one... Let me rephrase the question: Is anyone here using the Cordova plugin on Android and doesn't have any new notification erasing the previous one?

    thanks!

  • Avatar
    Rob Willett

    Mine don't collapse into one, I wish they did for some cases.

    What do you do to make them?

    Rob

  • Avatar
    elpetro

    Well, I'm using pushWoosh Cordova plugin v3.5.4 and the Web API. Works as expected for iPhone but not for android. I have attached above a trace of the object sent

  • Avatar
    Rob Willett

    So what do you send to collapse them?

    I'm still unclear.

    Rob

  • Avatar
    elpetro

    I send this object though API

        var url_prefix = 'https://cp.pushwoosh.com/json/1.3';
        var pushData = {
            request: {
            application: config.pushNotif.pushWooshAppCode,
            auth: config.pushNotif.pushWooshApiToken,
            notifications: [{
                send_date: "now", // YYYY-MM-DD HH:mm  OR 'now'
                ignore_user_timezone: true, // or false             
                devices: regIds,            
                data : data.data
            }]
            }
        };
        var notifConf = pushData.request.notifications[0];
        switch (data.platform) {            
            case 'ANDROID' :
                logger.info('PushNotifMgr platform ANDROID data= '+JSON.stringify(data));
                notifConf.content = data.msg;
                notifConf.platforms = [3];
                notifConf.android_priority = 1;
                notifConf.android_vibration = 1;
                if (data.picture) notifConf.android_custom_icon = data.picture;
                if (data.banner) notifConf.android_banner = data.banner;
                if (data.title) notifConf.android_header = data.title;
                if (data.sound) notifConf.android_sound = data.sound;
                if (data.root_params) notifConf.android_root_params= data.root_params;
            case 'IOS' :
                if (data.title) notifConf.content = data.title+' ';
                else notifConf.content = '';
                notifConf.content += data.msg;
                break;
            default :               
                break;
        }
    
        logger.info('PushNotifMgr sendPushWooshMsg sending info: '+JSON.stringify(pushData));
    
        request({
            url: url_prefix+'/createMessage', //URL to hit
            method: 'POST',
            json: pushData
        }, function(error, response, body){
            if(error) {
            logger.warn('PushNotifMgr sendPushWooshMsg failed sending notification with err: '+error);
            if (cb) cb(error, null);
            } else {
            logger.info('sendPushWooshMsg successfully sent push notification response: '+JSON.stringify(response));
            if (cb) cb(null, response.statusCode);
            }
        });
    

Please sign in to leave a comment.