I struggled a lot with this mistake, and I just gave up. Every time I try to send a message using GCM, this error appears in LogCat. What can not I do? I used Android examples to configure GCM notifications. This is a logcat error.
Edit: the message does go through, but I don't think this error is normal.
08-12 17:13:15.888: W/GTalkService(2237): [DataMsgMgr] broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE cat=[com.testing.encuesta] (has extras) }
AndroidManifest.xml
<permission android:name="com.testing.encuesta.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="com.testing.encuesta.permission.C2D_MESSAGE" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <uses-permission android:name="android.permission.INTERNET"></uses-permission> <uses-permission android:name="android.permission.VIBRATE"></uses-permission> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.testing.encuesta.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".Inicio"> </activity> <receiver android:name=".GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" > <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <category android:name="com.testing.encuesta" /> </intent-filter> <intent-filter> <action android:name="com.google.android.c2dm.intent.REGISTRATION" /> <category android:name="com.testing.encuesta" /> </intent-filter> </receiver>
My class is GCMBroadcastReceiver
public class GCMBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { String action=intent.getAction(); if(action.equals("com.google.android.c2dm.intent.REGISTRATION")) { String registrationID=intent.getStringExtra("registration_id"); Log.d("ID",registrationID); String error=intent.getStringExtra("error"); String unregistered=intent.getStringExtra("unregistered"); } else if(action.equals("com.google.android.c2dm.intent.RECEIVE")) { String data1=intent.getStringExtra("data1"); String data2=intent.getStringExtra("data2"); Toast.makeText(context, data1, Toast.LENGTH_LONG); } } catch (Exception e) { Log.d("Error", "error en C2DM"+e.toString()); } }
source share