2

I made an app using GCM for notifications. I used this tutorial and my code is pretty much identical

http://developer.android.com/google/gcm/client.html

I'm testing on physical devices and on some of the devices I am getting a SERVICE_NOT_AVAILABLE error when I try to register the device with GCM.

I have an exponential backoff setup so it does retry over time.

It works on about half of my test devices the others get a SERVICE_NOT_AVAILABLE error. Looked all over and haven't found a solution yet.

Any help would be greatly appreciated. Thank You!

2 Answers 2

5

You will also get this error if you simply do not have network connection.

4

SERVICE_NOT_AVAILABLE might mean that your device can't read the response or there was a 500/503 from the server. You already have a exponential back-off so server side shouldn't be a problem I suppose. See if you have "com.google.android.c2dm.intent.REGISTRATION" to the GCMBroadcastReceiver in your manifest and you are handling that. Check out : GCM SERVICE_NOT_AVAILABLE on Android 2.2 for detailed solution, if you haven't already. Comment if that works.

2
  • Yes! That did work. Very odd. The Android documentation didn't mention anything about this. Is this just a bug? or is it common practice to get registration ids this way. Also should I implement both methods of getting registration IDs? Or will this BroadCast one just work for everything. Thanks!
    – Dan
    Aug 20, 2013 at 1:01
  • My view is that the android documentation mentions here the following: Note that Google may periodically refresh the registration ID, so you should design your Android application with the understanding that the com.google.android.c2dm.intent.REGISTRATION intent may be called multiple times. Your Android application needs to be able to respond accordingly.. So to handle the renewal you might need to do that anyway. Also see this question. Aug 20, 2013 at 1:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.