I'm implementing GCM, which theoretically has a reasonable requirement, Android 2.3: https://developers.google.com/cloud-messaging/android/client
The problem is that it is working in my Android 5.1 devices and Android 4.4 devices, but it does not work in my Android 4.1 devices, LG and Huawei.
I can see this error in the logcat: GooglePlayServices not available due to error 2
In the previous link I can see this:
If you want to support pre-4.4 KitKat devices, add the following action to the intent filter declaration for the receiver:
So I added it, this is what I added in the manifest:
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> <!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <!-- This app has permission to register and receive data message. -->
<!-- Creates a custom permission so only this app can receive its messages. NOTE: APP_PACKAGE.permission.C2D_MESSAGE -->
<permission android:name="com.myapp.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.myapp.permission.C2D_MESSAGE" />
<!-- BroadcastReceiver that will receive intents from GCM services and handle them to the custom IntentService. -->
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
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="com.myapp" />
</intent-filter>
</receiver>
<service
android:name="com.myapp.util.notifications.GCMListenerService"
android:exported="false" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name="com.myapp.util.notifications.CustomInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
<service
android:name="com.myapp.util.notifications.RegistrationIntentService"
android:exported="false">
</service>
It is very frustrating since both devices are Android 4.1, much higher than Android 2.3.
Also before this, with my old implementation of GCM (before Google Play Services origins, when GCM was a .jar file called gcm.jar) works 100% fine on these 4.1 devices.
In the device 4.1 you are testing ,firstly you have to update your google play services of device..after that check your logs and show logs so that i can help you?