Closed irokhes closed 7 years ago
I'm trying to send notifications to IOs devices but when is in background they are lost.
var sanitizedData = JSON.stringify(data); sanitizedData = JSON.parse(sanitizedData); var message = new gcm.Message({ priority: 'high', content_available: true, data: sanitizedData, }); var sender = new gcm.Sender(config.push.gcm.apiKey); var registrationIds = tokenArray; sender.send(message, {registrationTokens: registrationIds}, 4, function(err, result) { if (err) { return reject(err); } else { return resolve(result); } });
If I use the firebase console it works.
{ "to": "XXXXXXXXXXX-TOKEN-XXXXXXXXXX", "content_available": true, "priority": "high", "data": { "type": "location", "data": { "valet": "58358a90c67acb0004d4742b", "status": "awaitingCustomer" } } }
I have no idea how to fix it.
@irokhes Set contentAvailable and not content_available in gcm.Message().
contentAvailable
content_available
Closing due to inactivity. Feel free to reopen if you still experience this issue.
I'm trying to send notifications to IOs devices but when is in background they are lost.
If I use the firebase console it works.
I have no idea how to fix it.