问题
I am developing app on Android GCM push notification. Everything works fine .But I am not able to get the notification message when my device is on wifi rather than on data plan of service provider. In my case data plan is 3G but and notification comes as usual to devices but when device is connected through wifi I am not able to get any notifications.
回答1:
Well this should not be the case, I have an android app that receives GCM push notifications regardless it is connected via 3G or Wi-Fi.
What I would suggest to troubleshoot this problem:
- When you send the push notification from the server make sure to NOT include
delay_while_idle
, so the notification get delivered right away. Also make sure you have settime_to_live
to a reasonable value (default is 4 weeks) - Try to hold a Wi-Fi lock in your app
- Test with different device and/or Android version (maybe it is a problem with certain hardware/API version)
来源:https://stackoverflow.com/questions/14563916/android-gcm-doesnt-work-with-wifi-networks-when-3g-network-is-available