I was trying to set this example: https://code.google.com/p/gcm/source/browse/#git%2Fgcm-client up and running.
The GoogleAPI project has been successfully created, according to the guide: http://developer.android.com/google/gcm/gs.html
However, I have the following problem: on some devices I get SERVICE_NOT_AVAILABLE no matter what.
W/System.err: java.io.IOException: SERVICE_NOT_AVAILABLE W/System.err: at com.google.android.gms.gcm.GoogleCloudMessaging.register(Unknown Source)
Some statistics:
It's the same code, the same apk file, various google accounts. I tried to switch back to GCMRegistrar methods and they actually work. So the question is: are new GCM methods in sort of beta? How to make them work on other devices, not just 'pure' Google Android devices?
Update: In fact, I found the solution here
Google Cloud Messaging (GCM) is a service that allows you to send push notifications from your server to your users' Android devices, and also to receive messages from devices on the same connection.
Google Cloud Messaging (GCM) for Android is a service that allows you to send data from your server to your users' Android-powered device, and also to receive messages from devices on the same connection.
Open your app's settings and select Intercom for Android. Then find the "Enable GCM" section.
A Registration ID is an identifier assigned by GCM to a single instance of a single application installed on an Android device. The device is assigned this identifier when it registers to Google Cloud Messaging. The GCM documentation doesn't specify what information is encoded in this identifier.
Sometimes it happened due to time syn with GCM. Please have a look at the time, if it is correct. If possible then reset.
Two more thing to check, if you are using a emulator then please make sure that you have the google api running on the emulator. and second gcm.jar is included on your project.
this is super stupid, but I have same error because I had "restrict app background data" option enabled for google services on my xperia)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With