问题
i'm creating an application and i'm using GCM to receive notifications, the problem is that when i call the function " gcm.register(SENDER_ID);" i'm getting "service not available". i searched a lot and many are facing this problem, i tried this solution:
GCM SERVICE_NOT_AVAILABLE on Android 2.2
but it is not working,(regId is null) please any one can help?
回答1:
The documentation says that:
When the application receives a com.google.android.c2dm.intent.REGISTRATION intent with the error extra set as SERVICE_NOT_AVAILABLE, it should retry the failed operation (register or unregister).
with other words, the registration failed on GCM servers and you should retry the operation again.
Make sure that you have Google Play Services installed on the device, and that you are on a stable internet connection.
来源:https://stackoverflow.com/questions/18766119/google-cloud-messaging-service-not-available