java - broadcast intent cancelled. Android GCM -
i've been struggling error lot , gave up. every time try send message using gcm error appears on logcat. i'm failing do? i've followed android examples set gcm notifications. logcat error
edit: message gets through don't think error 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 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()); } }
fixed, need add setresultcode(activity.result_ok); @ end of onreceive(); method
Comments
Post a Comment