My node-gcm server returns a success like this when a push notification is sent:
`[www-0 (out)] { multicast_id: 7051546908748783000,
[www-0 (out)] success: 1,
[www-0 (out)] failure: 0,
[www-0 (out)] canonical_ids: 0,
[www-0 (out)] results: [ { message_id: '0:1417551457143771%cfb88281f9fd7ecd' } ] }`
However, the app never receives the push notification.
This is my register function:
`if (device.platform === 'Android') {
pushNotification.register(gcmSuccessHandler, genericErrorHandler, {
'senderID': 'XXXXXXXX',
'ecb': 'window.onNotificationGCM'
});`
Here's the callback function:
`window.onNotificationGCM = function (notification) {
// Great scott - msg received!
window.alert(('GCM PUSH RECEIVED! ' + window.prettyPrint(notification)));
switch (notification.event) {
case 'registered':
// Success
if (notification.regid.length > 0) {
console.log('Successfully got GCM device registration ID:' + notification.regid);
}
// Error getting reg id
else {
console.error('Error registering with GCM push server: No device reg ID received.');
}
break;
}
}`
The register function is called as soon as the app is run so the window.alert is called once which gives me the regId. However, after that, I do not receive any push notification, no matter if the app is opened/closed.
I have copied the regId and tried sending push notifications with node-pushserver and ruby pushmeup. Both of them receives the same success message. So, I am guessing it's not a server issue.
Lastly, push notification was working fine about a week ago. It stopped suddenly and I didn't make any changes to anything related to push either.
EDIT: Push notification works perfectly fine on genymotion emulator! And, yes push notification is enabled on my device and I do receive push notification for all other apps on my phone. Any idea?