Reputation: 1168
I am developing an android application in which I would like to implement the GCM feature. I could able to implement and it is working fine in Android Kitkat 4.4 version (Tested on Micromax 089). But not working in the devices(such as Lava Iris Fuel F1 and Moto x play) which runs on Android Lolipop(Android 5.0) and above.
The code snippet which I used for verifying the device dependencies and Manifest permissions
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
registerReceiver(mHandleMessageReceiver, new IntentFilter(
DISPLAY_MESSAGE_ACTION));
and the app crashed at GCMRegistrar.checkDevice(this);
Screenshot of Logcat.
With some research , I found some of the reasons that I listed below,by which the app may be crashed
Even I have verified all the above scenarios, could not fix the issue.
Please help me finding the solution.
Upvotes: 2
Views: 211
Reputation: 722
Have you added this code in your manifest?
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<!-- Receives the actual messages. -->
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<!-- Receives the registration id. -->
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="<YOUR PACKAGE NAME>" />
</intent-filter>
</receiver>
By the way GCMRegistrar is obselete and i wouldnt recommend it. Use this GCM Android
You can try using the Google Cloud Messaging library instead of the deprecated library that contains GCMRegistrar. This is because some devices don't have this package com.google.android.gsf in their skin of Android particularly Lenovo and Motorola which is why you must be getting the Unsupported Exception on checkDevice()
Upvotes: 6