ToothlessGear / node-gcm

A NodeJS wrapper library port to send data to Android devices via Google Cloud Messaging
https://github.com/ToothlessGear/node-gcm
Other
1.31k stars 206 forks source link

Message can only be sent if device is active, otherwise, message not deliverable #132

Closed xhe closed 9 years ago

xhe commented 9 years ago

I used this plugin to send message to android, so far so good, thanks. But I found one issue, don't know if this is intended. If my device is on, which means, the screen is on, or just off, message can be received in the phone, no problem, but if my phone is in inactive status for couple minutes, message can no longer be delivered. I googled a lot, someone said it is because GCM is using TCP port xxx, and if the phone is inactive, network will be disconnected. Time varies based on different network provider. have you guys experienced this senario? If so, this might be a biggest issue for GCM. But my iPhone has no issue at all, it can instantly receive message no matter if user is active or not. Thanks

hypesystem commented 9 years ago

This is a client-side issue, that you need to resolve in the receiving app. You used to have to use a WakefulBroadcastReceiver, but I think this has recently changed with Android M.