GCM SERVICE_NOT_AVAILABLE on Android 2.2
I experienced the same problem. GCM works fine on my Tablet running Android 4.04, but always received a SERVICE_NOT_AVAILABLE on my smartphone running Android 2.3.
I found following workaround not using (so far as I know) any deprecated classes. Add the action "com.google.android.c2dm.intent.REGISTRATION" to the GCMBroadcastReceiver in your manifest. This will enable to receive the registration_id at your GCMBroadcastReceiver.
<receiver
android:name="YOUR_PACKAGE_NAME.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="YOUR_PACKAGE_NAME" />
</intent-filter>
</receiver>
After that your GCMBroadcastReceiver is able to receive the registration_id:
public void onReceive(Context context, Intent intent) {
String regId = intent.getExtras().getString("registration_id");
if(regId != null && !regId.equals("")) {
/* Do what ever you want with the regId eg. send it to your server */
}
}
Although I still get a SERVICE_NOT_AVAILABLE error, I can handle the registration_id in my GCMBroadcastReceiver and I am able to send messages to my smartphone. Quite weird, but it works for me.
SERVICE_NOT_AVAILABLE some devices on Android GCM
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.
error SERVICE_NOT_AVAILABLE only in new GCM client sample
The new GCM API has bug which is still not resolved.
However, the new GCM works on devices with API level 17 and higher. So you can continue using the depreciated API till the issue gets resolved.
Related Topics
Android Studio - Creating Modules Without Copying Files
How to Cancel an Dialog Themed Like Activity When Touched Outside the Window
Android: How to Use Webcam in Emulator
How to Get Retrofit Success Response Status Codes
Libpng Error: Not a Png File Error Showing in Android Studio
Adb Server Is Out of Date. Killing
Expand/Collapse Lollipop Toolbar Animation (Telegram App)
How to Use Holo.Light Theme, and Fall Back to 'Light' on Pre-Honeycomb Devices
Android: Can Height of Slidingdrawer Be Set with Wrap_Content
Android: Why Is There No Maxheight for a View
List All the Files from All the Folder in a Single List
How to Get Multiple Icons to Launch Different Activities in One Application
Error Loading the Sdk When Eclipse Starts
Android Toggle Button Custom Look
Android Play Services 6.5: Locationclient Is Missing
Android: Asynctask to Make an Http Get Request