I'm sending notifications to an android device using node-gcm, and in some cases, I need to send an image with the notification to display as a thumbnail, like so: notification with thumbnail
And sometimes I need to send notifications without the thumbnail. With the below code I can send the image in the notification, the problem is when another notification is received, they collapse, making the new one overwriting a notification that was already there:
var message = new gcm.Message({
"data" : {
"title" : "Test",
"message" : "Test message!",
"priority" : 2, // Highest priority.
"ledColor" : [255, 0, 0, 1],
"content-available": "1",
"image": req.body.notificationImageUrl, //<-- image URL
},
});
But if I set up the message like below, I can't find a way to send the image but the notifications do not collapse and all of them appear. Another problem is that the led does not activate in this version:
var message = new gcm.Message({
data: {
"priority" : 2, // Highest priority.
"content-available": "1",
"image": req.body.notificationImageUrl, // <-- image URL
},
notification:{
title: "Test",
body: "Test message!",
color: "#892121",
sound: 'default',
vibrationPattern: [300, 150, 300], // Vibrate for 300ms then wait 150ms and then vibrate for 300ms.
ledColor: [255, 0, 0, 1], // <-- this does not work
},
});
What I want is a way to send the notification with the thumbnail in a way that it does not overwrite a notification that was previously there.
EDIT: I forgot to mention, im using Ionic Framework with Cordova so I can't manage the notifications in the device unless there is a way to do it through those frameworks. Thanks in advance!