I am using the node-gcm module to send Push Notifications to my Cordova app.
The server reports that it has successfully delivered the message to my device.
The notifications appear on the device if the app is running in the background, but do not come up if the app is not running at all.
From my reading I believe I need to set priority: 'high'
to fix this, however from my tests this does not work. Either I am setting that incorrectly, or there is something else I need to do.
Here is my send code:
var msgJson = {
priority: 'high',
contentAvailable: true,
"data": {
title: title,
body: message_text,
icon: 'ic_launcher',
sound: true,
extra_data
}
};
var message = new gcm.Message( msgJson );
console.log(message);
sender.send(message, { registrationTokens: push_tokens }, function (err, response) {
if(err) {
console.error('Error sending Google Cloud Message notification:', err, response);
} else {
console.log('Android notification successful send to', push_tokens, response);
}
});
Why are my notifications not coming up on the device when the app is fully closed?