I am getting the error "SERVICE_NOT_AVAILABLE" on my GoogleCloudMessaging.register() call on a Android 2.2 device.
I am writing an app that uses GoogleCloudMessaging using the new Google Play Services. I implemented it using the guidelines provided on the Android website and my source contains a lot of error checking and handling code such as making sure the Google Play Services is installed, or updated. The GCM registration code also implements a exponential backoff as google as suggested one to implement to handle the SERVICE_NOT_AVAILABLE error.
I have tested my application on a wide array of devices including ICS, JB, Honey Comb and even 2.3.x devices. The GCM registration works and I am able to send messages to it via GCM. However on a 2.2 device I am continuously getting a SERVICE_NOT_AVAILABLE error on the GoogleCloudMessaging.register() call even with the exponential backoff in place.
The device that GCM is failing on is a Samsung SGH-I896 to be exact and the phone has 2 google accounts on it. I've read that this error might be caused by a misconfigured time, but the time is set to be automatic. The phone is not moded and is running samsung stock ROM.
I have also tried rebooting the device as well as reinstalling Google Play Services without luck. Any help on this issue will be greatly appreciated.
EDIT: I tried to implement GCM using the old gcm.jar and GCMRegistrar and it ended up working on the device. However I hardly consider this a good solution to the problem as Google has stopped supporting this method afaik.
EDIT2: See the accepted answer.
I know this is an old post, but I just had the same problem, while everything was setup correctly. The SERVICE_NOT_AVAILABLE error, kept popping up. After going to settings => apps => Google Play-servises, and clear the cache and remove the data, it worked.
This error also occurred to me, but it did because I was trying to register in the GCM through a firewall of my company. And in the documentation I found:
Once I opened the ports or tried from another network, it worked.
For the time being, until either Google fix this bug or someone provides a better solution I am using a hybrid solution where it will use Google Player Services for the first few times (with exponential backoff) but switch to GCMRegistrar afterwards.