android - GCM Invalid sender error -
i'm stuck while on mysterious problem. implemented gcm in android app, receive invalid_sender error.
- my sender_id id url of google project.
- the android push notifications on
the weird thing have registration id send notifications to. console looks this:
03-26 09:39:20.233: i/<test>(19761): registered: apa91bg6- o3onzt50eajyvj5ketv3qalpon2sfopxez7slamaaokhtn6emdjb91gfiwkftzkjiub6uoek4o- wqp7kk2ozgqjz1vczzs0wddqtjfacfyfzfb7sew3is1sd4cajcdze4la1f0hxzc7ss1uiyhxx-xxxx 03-26 09:48:23.522: i/<test>(19925): gcmintentservice 03-26 09:39:20.670: i/<test>(19761): on error invalid_sender
inside oncreate:
gcmregistrar.checkdevice(this); gcmregistrar.checkmanifest(this); final string regid = gcmregistrar.getregistrationid(this); if (regid.equals("")) { log.i("<test>", "registering"); gcmregistrar.register(this, "2194354949xx"); } else { log.i("<test>", "already registered: " + regid); }
broadcastreceiver:
public class gcmbroadcastreceiver extends com.google.android.gcm.gcmbroadcastreceiver{ @override protected string getgcmintentserviceclassname(context context){ return "be.xxx.xxx.system.gcmintentservice"; } }
gcmintentservice:
public class gcmintentservice extends gcmbaseintentservice { @override protected void onerror(context arg0, string errorid) { log.i("<test>","on error " + errorid); } @override protected void onmessage(context arg0, intent intent) { log.i("<test>","onmessage " + intent.getextras().tostring()); } @override protected void onregistered(context arg0, string regid) { log.i("<test>","registration id: " + regid); } @override protected void onunregistered(context arg0, string regid) { log.i("<test>","onunregistered " + regid); } public gcmintentservice() { super("2194354949xx"); log.i("<test>","gcmintentservice "); } }
manifest:
<permission android:name="com.xx.xx.permission.c2d_message" android:protectionlevel="signature" /> <uses-permission android:name="com.smstiming.hezemans.permission.c2d_message" /> <uses-permission android:name="com.google.android.c2dm.permission.receive" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.get_accounts" /> <uses-permission android:name="android.permission.wake_lock" /> <uses-permission android:name="android.permission.vibrate" /> <receiver android:name="be.xx.xx.system.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="com.smstiming.hezemans" /> </intent-filter> </receiver> <service android:name="be.xx.xx.system.gcmintentservice" />
finally got around this. accidentally trying use the 'project id' instead of 'project number'. google developer console provides both on overview page, make sure using correct one.
Comments
Post a Comment