I am trying to add push notification feature to my application, but i have
strange problems.
In my first try, i got regId for device; but after that device trying to
unregister it self from GCM; actually it succeeed becuase i lost regId but
not i couldn't get it again.
In LogCat i see these lines.
07-12 08:40:25.615: V/GCMRegistrar(10648): Registering receiver
07-12 08:40:25.620: D/GCMRegistrar(10648): resetting backoff for PACKAGENAME
07-12 08:40:25.635: V/GCMRegistrar(10648): Unregistering app PACKAGENAME
07-12 08:40:28.570: D/GCMRegistrar(10648): resetting backoff for PACKAGENAME
07-12 08:40:28.570: V/GCMRegistrar(10648): Unregistering app PACKAGENAME
07-12 08:40:29.125: D/GCMRegistrar(10648): resetting backoff for PACKAGENAME
07-12 08:40:29.130: V/GCMRegistrar(10648): Unregistering app PACKAGENAME
07-12 08:40:39.655: D/GCMRegistrar(10648): resetting backoff for PACKAGENAME
07-12 08:40:39.660: V/GCMRegistrar(10648): Unregistering app PACKAGENAME
07-12 08:40:40.605: D/GCMRegistrar(10648): resetting backoff for PACKAGENAME
07-12 08:40:40.605: V/GCMRegistrar(10648): Unregistering app PACKAGENAME
07-12 08:40:41.350: D/GCMRegistrar(10648): resetting backoff for PACKAGENAME
07-12 08:40:41.350: V/GCMRegistrar(10648): Unregistering app PACKAGENAME
07-12 08:40:43.255: D/GCMRegistrar(10648): resetting backoff for PACKAGENAME
07-12 08:40:43.255: V/GCMRegistrar(10648): Unregistering app PACKAGENAME
I tried to implement GCM Demo Application's code to my application, so here
is the code.
GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);
registerReceiver(mHandleMessageReceiver, new IntentFilter(
DISPLAY_MESSAGE_ACTION));
final String regId = GCMRegistrar.getRegistrationId(this);
if (regId.equals("")) {
// Automatically registers application on
// startup.
GCMRegistrar.register(this, SENDER_ID);
} else {
Log.v(TAG, "Already registered");
// Device is already registered on GCM, needs to
// check if it is
// registered on our server as well.
if (!GCMRegistrar.isRegisteredOnServer(this)) {
// Try to register again, but not in the UI
// thread.
// It's also necessary to cancel the thread
// onDestroy(),
// hence the use of AsyncTask instead of a
// raw thread.
final Context context = this;
mRegisterTask = new AsyncTask<Void, Void, Void>() {
mRegisterTask.execute(null, null, null);
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en