google cloud messaging - Registering - Unregistering Device from Android GCM -
I am trying to add push notification feature to my application, but I have strange problems.
In my first attempt, I found regId for the device; But after that the device is trying to unregister itself from GCM; In fact it succeeded because I was lost regId, but I could not get it again.
I look at these rows in logcat.
07-12 08: 40: 25.615: V / GCMRegistrar (10648): Registration receiver 07-12 08:40 40: 25.620: D / GCM registrar (10648): Resetting backoffice for packageddom 07-12 08: 40: 25.635: V / gcm registrar (10648): unregistered application PACKAGENAME 07- 12 08: 40: 28.570: D / GCMRigestar (10648): Resizing back-up for packaging 07-12 08:40 40: 28.570: V / GCM Registrar (10648): Unregistered App PACKAGENAME 07-12 08:40: 29.125: D / GCM Registrar (10648): PACKAGENAME 07-12 08:40 40: 29.130: Reset for V / GCM Registrar (10648) Bank backoff: Unregistered app PACKAGENAME 07-12 08:40: 39.655: D / GCM registrar (10648): Resetting backoffice for packageddom 07-12 08:40: 39.660: V / gcm registrar (10648): unregistered app PACKAGENAME 07- 12 08:40 40: 40.605: D / GCM registrar (10648): Resetting backoffice for packageddom 07-12 08:40 40: 40.605: V / GCM registrar (10648): unregistered application PACKAGENAME 07-12 08:40: 41.350: D / GCM Registrar (10648): For Resetting Backup PACKAGENAME 07-12 08:40: 41.350: V / GCMR Registry (10648): Unregistered app PACKAGENAME 07-12 08:40: 43.255: D / GCM Registrar (10648): Resetting backoffice for PACKAGENAME 07-12 08:40: 43.255: V / GCMRegistrar (10648): Unregistered application PACKAGENAME I tried to apply the code of GCM demo application in my application, so here's the code.
GCMRegistrar .checkDevice (this); GCMRegistrar.checkManifest (this); Register Receiver (mHandleMessageReceiver, new IntentFilter (DISPLAY_MESSAGE_ACTION)); Final string regId = GCMRegistrar.getRegistrationId (this); If (regId.equals ("")) {// automatically registers the application at // startup GCMRegistrar.register (this, SENDER_ID); } Else {Log.v (TAG, "already registered"); // The device is already registered on GCM, // need to check whether // is also registered on our server. If you try to register again (! GCMRegistrar.isRegisteredOnServer (this)) //, but not in UI / thread. // It is also necessary to cancel the thread // onDestroy (), // Therefore use the AsyncTask instead of a // raw thread, the last reference reference = this; MRegisterTask = New AsyncTask & lt; Zero, zero, zero> () {MRegisterTask.execute (zero, zero, zero); }}}}
I found my problem, my own fault and stupidity. / P>
I was added GCMRAgaster. In this Registry () evaluation for code; Therefore, every step on debug is due to re-evaluate this code and make uncontrolled calls. I do not want to delete it, anyone like me can be;)
Comments
Post a Comment