GCM - problem after client application uninstalled

6,748 views
Skip to first unread message

tomasz.ja...@avantis.pl

unread,
Oct 22, 2013, 9:24:38 AM10/22/13
to andro...@googlegroups.com
We are working on application using Google Cloud Messaging for Android but we have problem with detecting when the client application was uninstalled from the device. Due to the documentation (http://developer.android.com/google/gcm/adv.html#unreg) when the application is uninstalled from the device and the 3rd-party server sends a second message to GCM then the GCM server should response with 'NotRegistered' error message. But it doesn't work this way. We uninstalled the client application from mobile device  and tried to send many messages to the application but we still receive not null messageId and no errors. The application was unistalled 3 days ago and even now we have no 'NotRegistered' error. There is no application installed on the device so obviously messages are not delivered. 

We noticed the problem on Samsung GT-S5830 (android ver. 2.3.5, kernel: 2.6.35) and LG P760 (android ver. 4.1.2, kernel ver. 3.0.31). Before application was uninstalled all messages had been successfully delivered to the device. The application was unistalled using classic android unistaller tool (Settings -> Applications  -> Manage application ->Uninstall) and we couldn't unregister client manualy using GCMRegistrar.unregister(). 

Has anyone know how resolve this problem? It's very important for us to know if application was unistalled or not. Is the related with devices/android versions or something else?

Thanks for help,
Tomek

notify...@gmail.com

unread,
Oct 23, 2013, 3:20:11 PM10/23/13
to andro...@googlegroups.com
We are seeing the same problem, we uninstalled our app over the weekend while the 3rd party server continued to send messages to the registration ID associated with the device / app.  At no point did we receive a NotRegistered error message.  Is there a fix or workaround for this?

Henri

unread,
Oct 31, 2013, 6:36:33 AM10/31/13
to andro...@googlegroups.com
I'm seeing this problem as well.
Some (uninstalled) registration_id's from about a month ago do return 'NotRegistered', but newly registered and uninstalled applications stay registered, as far as GCM's reponse is concerned.

I'm really curious if anyone has a solution!

Lukasz Toczek

unread,
Jan 28, 2014, 2:39:41 AM1/28/14
to andro...@googlegroups.com
Same issue here. 16 hours and counting, unregistered manually, and after 30 minutes uninstalled the application altogether, and still the push messages are being sent to the device, while the server gets "OK" message without the "NotRegistered" part. What the hell?!

ranjit R

unread,
Jan 28, 2014, 5:22:55 AM1/28/14
to andro...@googlegroups.com
Intent service  respective application is largely responsible for communicating with the GCM service which is running in the phone .
So unregistered or  stop the service will stop msg from GCM service.

Lukasz Toczek

unread,
Jan 28, 2014, 6:40:18 AM1/28/14
to andro...@googlegroups.com
I'm sorry? 

You mean to stop the GCM client service on the phone, to stop receiveing push messages? Did I get it right?

Lukasz Toczek

unread,
Feb 1, 2014, 2:11:02 AM2/1/14
to andro...@googlegroups.com
Any response to this humongous issue?


W dniu wtorek, 22 października 2013 15:24:38 UTC+2 użytkownik tomasz.ja...@avantis.pl napisał:

Costin Manolache

unread,
Feb 1, 2014, 12:46:57 PM2/1/14
to andro...@googlegroups.com
We are aware of this and investigating. 

It is a bit complicated - this is part of the changes needed to fix the old 'app getting unregistered if it gets a message while upgrading' bug. As a result a lot of developers register very frequently, causing a large number of writes. There were also issues when the registration ID changed.

If you see this behavior you may also notice that if the app is installed again it would get the old registration ID. 

The change is supposed to delay the unregistration - and send a message to the device and wait back confirmation before performing disabling the registration.

It helps to include a registration ID and information about the device - in particular the version and the PlayServices version. 

Costin
 


--
You received this message because you are subscribed to the Google Groups "android-gcm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-gcm...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-gcm/0e3d5523-bdc7-45b6-b36d-80659db4ac4f%40googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Martin Revert

unread,
Feb 6, 2014, 10:59:27 AM2/6/14
to andro...@googlegroups.com

Hi Costin, in my particular case i never recieved an error: Not Registered response even if the app is rightfully uninstalled and the RECEIVER is clearly not present.
When a I say never I could say that for several months I didn't received this kind of response. Months before, GCM worked as expected. Now, I'm only receiving OK unrelated errors like "internal Server Error" or "Missing Register ID" but not the genuine unregistration messages.

All this behavior was checked under 4.1.x Play Services with any Android version, I don't have the new 4.2.x Play Services yet to tell you if it behaves the same.

For me it seems that unregistration is not happening on GCM side resulting in a notorious incremental overwork for your side and for us as 3rd party. us know

Let us know how can we colaborate to solve this.

Regards,
Martin

Costin Manolache

unread,
Feb 7, 2014, 1:54:12 PM2/7/14
to andro...@googlegroups.com
We've found a server bug, should be resolved in next push. Also disabled most of the 
experiments until we sort all the details.

Sorry for not sending more details about the changes - it was supposed to be the final
fix for the 'registration lost if message received while upgrading'. 

Costin 


Lukasz Toczek

unread,
Feb 9, 2014, 2:41:52 AM2/9/14
to andro...@googlegroups.com
Honestly, that's a very good news, and finally a proper response from you guys on these reports (that to be honest, started months ago, and gcm team seemed to not be interested in those).

So again, thanks guys for investigating it and finding a hole in a system. Would you please tell us, when can we test the fix, so that we can see on our end if it's resolved?

sincerely
Lucas

Martin Revert

unread,
Feb 13, 2014, 6:18:25 PM2/13/14
to andro...@googlegroups.com
Well, I only received on 02/11 some legit "Not registered" responses, but after that the same behavior of last months: App uninstalled and "Not Registered" is never coming as a response.
Clearly is not fixed yet.
Did you noticed the same Lucas?

Martin

Costin Manolache

unread,
Feb 14, 2014, 6:42:18 PM2/14/14
to andro...@googlegroups.com
The fix is scheduled to go to prod next week, if no problems are found on staging.

The experiments should be disabled for now - if they get enabled again and your 
device is matched, the behavior should be that 'NotRegistered' will be delayed for 3 
failed messages and 15 minutes.


Costin


Martin Revert

unread,
Feb 14, 2014, 7:53:54 PM2/14/14
to andro...@googlegroups.com
Thanks for the info Costin!!!
Allow me to suggest, whenever you can after this fix go productive, to add the new behavior to the GCM "Unregistration" section on Android Developers GCM's advanced documentation: http://developer.android.com/google/gcm/adv.html. Mostly to cover future doubts, questions and possible mistakes.

Have a nice weekend!
Martin

Martin Revert

unread,
Feb 22, 2014, 4:12:25 AM2/22/14
to andro...@googlegroups.com
Nice! Since yesterday, "Not registered" behavior is back !!!

Thank you again Costin!


--
You received this message because you are subscribed to a topic in the Google Groups "android-gcm" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-gcm/gScadiCjK-g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-gcm...@googlegroups.com.

To post to this group, send email to andro...@googlegroups.com.

Gadi Paz

unread,
Feb 23, 2014, 2:16:08 AM2/23/14
to andro...@googlegroups.com
Hi Martin,
Can you please tell me how much time did you wait after uninstalling your app from the device?
I uninstalled my app from the device a half an hour ago and still getting "Success" from gcm server.

My problem is that I don't know if my clients uninstalled the app,
I tried to find a solution for that but didn't work it out.

Thanks,
Gadi Paz

Martin Revert

unread,
Feb 23, 2014, 9:59:19 PM2/23/14
to andro...@googlegroups.com
Hi Gadi:

You could do it by yourself uninstalling your app on your terminal/emulator and sending messages only for that specific registration_id.

Anyway, I'm checking my server logs and the last 2 days (02/22 and 02/23) was not working again, so maybe the solution is not 100% productive yet or the fix is failing for some reason.

Let's see what Costin has to say about it.

Regards,
Martin


Gadi Paz

unread,
Feb 24, 2014, 1:22:34 AM2/24/14
to andro...@googlegroups.com
Thanks Martin,
This is exactly the check that I did,
I uninstalled my app from my device but still getting "Success" instead of "NotRegistered" from GCM server.

I'm waiting for Costin's suggestion.

Thanks,
Gadi Paz

Costin Manolache

unread,
Feb 24, 2014, 12:23:46 PM2/24/14
to andro...@googlegroups.com
Unfortunately the change was rolled back, I'll update the thread when we find a better solution.

My advice is to not rely on GCM to provide 'user uninstalling an app' notifications. It seems common
practice for GCM senders to periodically call register() and contact their servers, you can use this
as a better way to track if an app is installed and available on a device.

It is also a good idea to not rely on GCM registration IDs as a long-lived identifier - you can 
generate your own device ID and pass it along with registration IDs to your server. 

Costin




Martin Revert

unread,
Feb 25, 2014, 2:29:02 PM2/25/14
to andro...@googlegroups.com
Thank you for the update Costin!

I'm so sorry to read the fix was rolled back.

Personally i can't talk for others but I'm not relying on uninstall to notify about nothing to users. With the app unistalled we have no access or need to notify about nothing to users, so I think that's not the problem because is not a common business case (There's no Intents defined by Google to do something like monitoring package uninstalls on the SDK, so, correct if I'm wrong but trying to do something like that with GCM will be also unprecise and useless). My real main concern is the overload on 3rd party servers to query and serialize registration_ids to apps/devices that not need information from us anymore. As I said to you before, I'm quite sure that this also produces an overwork on Google's GCM servers, because you are trying to deliver a message to a nonexistent app unnecesarily. Even if you have unlimited "Google juice", keeping things in this status it seems to me bad design and a waste of resources.

About your second suggest, well, I prefer to use barely the registration_id as identifier. Any change that affects its lifecycle can be managed directly (canonical, errors, success) if GCM team not fails to honor actual behavior as it is documented. The main reason of my intransigence is that I want to be fair to users, respect their privacy without generating or taking any aditional data from their devices. Registration_ids are ideal for this and of course, not polling my servers and not overkill users batteries with unnecesary aditional network requests is a good Android citizen behavior also.

I hope the fix arrives at some moment and thanks for the 02/21 small window activation of the fix, it helped to make some clean of old ids.

Regards,
Martin




Costin Manolache

unread,
Feb 25, 2014, 5:00:58 PM2/25/14
to andro...@googlegroups.com
On Tue, Feb 25, 2014 at 11:29 AM, Martin Revert <martin...@gmail.com> wrote:
Thank you for the update Costin!

I'm so sorry to read the fix was rolled back.

Personally i can't talk for others but I'm not relying on uninstall to notify about nothing to users. With the app unistalled we have no access or need to notify about nothing to users, so I think that's not the problem because is not a common business case (There's no Intents defined by Google to do something like monitoring package uninstalls on the SDK, so, correct if I'm wrong but trying to do something like that with GCM will be also unprecise and useless). My real main concern is the overload on 3rd party servers to query and serialize registration_ids to apps/devices that not need information from us anymore. As I said to you before, I'm quite sure that this also produces an overwork on Google's GCM servers, because you are trying to deliver a message to a nonexistent app unnecesarily. Even if you have unlimited "Google juice", keeping things in this status it seems to me bad design and a waste of resources.

In terms of overhead - returning the 'uninstall' status is actually more expensive, and limits some optimizations.


 

About your second suggest, well, I prefer to use barely the registration_id as identifier. Any change that affects its lifecycle can be managed directly (canonical, errors, success) if GCM team not fails to honor actual behavior as it is documented. The main reason of my intransigence is that I want to be fair to users, respect their privacy without generating or taking any aditional data from their devices. Registration_ids are ideal for this and of course, not polling my servers and not overkill users batteries with unnecesary aditional network requests is a good Android citizen behavior also.

I think the current doc is: 

"If the application is automatically unregistered, which can happen (but is not guaranteed) if the user uninstalls the application."

"If the registration ID expires. Google might decide to refresh registration IDs."



Costin

John S.

unread,
Feb 28, 2014, 2:52:28 AM2/28/14
to andro...@googlegroups.com
We are experiencing the same issue that everyone else in this thread is commenting: In our Android app we aren't receiving NotRegistered responses anymore.
This is very important to us as we use this event to fall back to other alternate communication methods between the business and our registered clients.

If there is a bug in the GCM service, when can we expect it to be resolved?
If it was a feature that has been removed from the GCM service, would you kindly provide a comprehensive mechanism to help us identify between the cases of "becomes uninstalled" and "installed but inactive"?

Thank you very much.
Message has been deleted

Israel Cardenas

unread,
Mar 4, 2014, 7:33:49 AM3/4/14
to andro...@googlegroups.com
We are experiencing the same issue too. I think it's a widespread problem. I have some apps 

I have some applications which really do not care not receive this error, because I do not need to control what users keep the application installed. 

But in my company we have an application in which this information is vital. Our application allows to replace the sending and receiving of SMS messages as push notifications, and we use the GCM errors to fall back and start to sending SMS messages again between the business and our registered clients.

This bug is creating us a lot of problems, and putting a newly created service (which has cost a great effort and money to move forward) in grave risk (apart from our jobs!).

From the last posts, have I to believe that the best option (until the bug will be corrected) is to "ping" from the application to the server of our company, making sure that the application is still alive in the terminal? That's not a fudge?

Lukasz Toczek

unread,
Mar 7, 2014, 4:26:41 PM3/7/14
to andro...@googlegroups.com
Thanks Costin for the answer and for the updates (I appriciate those, as any answer is better than no answer), but to be honest this is completely unnacceptable from google GCM team. We are developers ourselves, so we understand things don't get fixed by themselves, but this issue is known for months now, I'm not completely sure, but it might be almost a year (I remember seeing people reporting it already way, way back, months before I tried an app with gcm's).

How can external server know that the app was uninstalled? Even with some hack arounds, like trying to notify the server before app is uninstalled(not sure if it's possible to begin with as I didn't dig around) there is no foolproof solution, and only, ONLY GCM server in conjunction with GCM client on the device can tell the application server, that the device does not wish to receive push's anymore. I mean, you controll all the middleware (gcm server and gcm client and the permanent http connection between them), and the fact it is still not fixed, and now it seems it can be not fixed for a long, long time is very troubling. Seriously. Can you put some light, onto why the GCM team find it so hard to fix this issue? I mean, shouldn't it be pretty straightforward, and exactly as is described in the gcm documentation? That logic is very sound, and seems like it should be working perfectly (gcm server sends push to device, device discovers the destination app is uninstalled and lets know of it to the gcm server, the next time gcm server gets push from the external server, it responds with unregistered server) so why it doesnt?

On top of it, this service (according to gcm guy in every year's google io talk) is used by milions and milions triggers every day, so this should be a priority by gcm team to fix it.

Please update us shortly on the status of the works on the fix.

Lukasz Toczek

unread,
Mar 7, 2014, 4:28:33 PM3/7/14
to andro...@googlegroups.com
Hey Martin

Well as you saw, I kinda "Went away" for a while to give some time to gcm team to fix it, but as you are aware now, this is still not fixed. I did test it some weeks ago, and it wasn't fixed then.

Ritesh Paul

unread,
May 9, 2014, 3:08:01 AM5/9/14
to andro...@googlegroups.com
I have implemented server side GCM with App engine. Even I do not get ERROR_NOT_REGISTERED when I send message to a device which has uninstalled the app. I need to know this information so that I can update my database. GCM team or anyone, help please??


On Tuesday, 22 October 2013 18:54:38 UTC+5:30, tomasz.ja...@avantis.pl wrote:

Martin Revert

unread,
May 9, 2014, 5:25:55 PM5/9/14
to andro...@googlegroups.com
For me this is working OK as intended since Feb 21.
Please read above messages, maybe you have to wait more before expecting a "Not registered" error.

Regards


--
You received this message because you are subscribed to a topic in the Google Groups "android-gcm" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/android-gcm/gScadiCjK-g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to android-gcm...@googlegroups.com.

To post to this group, send email to andro...@googlegroups.com.

Ritesh Paul

unread,
May 14, 2014, 12:12:16 PM5/14/14
to andro...@googlegroups.com
No this is still now working. I have read the entire thread here and other users are also experiencing the same problem. How long do we have to wait for the Not Registered? 

Martin Revert

unread,
May 14, 2014, 1:15:09 PM5/14/14
to andro...@googlegroups.com

I repeat. This is currently working as intended. Check your testing methods because they're defenitively wrong.

Ritesh Paul

unread,
May 14, 2014, 3:02:41 PM5/14/14
to andro...@googlegroups.com
ok so here is the implementation - 

   try {
     result = sender.sendNoRetry(message, regId);
   } catch (IOException e) {
     logger.log(Level.SEVERE, "Exception posting " + message, e);
     taskDone(resp);
     return;
   }
   if (result == null) {
     retryTask(resp);
     return;
   }
   if (result.getMessageId() != null) {
     logger.info("Succesfully sent message to device " + regId);
     String canonicalRegId = result.getCanonicalRegistrationId();
     if (canonicalRegId != null) {
       // same device has more than on registration id: update it
       logger.finest("canonicalRegId " + canonicalRegId);
       Datastore.updateRegistration(regId, canonicalRegId);
     }
   } else {
     String error = result.getErrorCodeName();
     if (error.equals(Constants.ERROR_NOT_REGISTERED)) {
       // application has been removed from device - unregister it
       Datastore.unregister(regId);
     } else {
       logger.severe("Error sending message to device " + regId
           + ": " + error);
     }
   }

the code highlighted in yellow should trigger on ERROR_NOT_REGISTERED and delete the reg ID but never does so, any thoughts?

Martin Revert

unread,
May 15, 2014, 12:12:50 PM5/15/14
to andro...@googlegroups.com

If you are using GCM HTTP you need to parse Google's JSON response where you will never find the unregistered devices in the way that you are trying todo do.

Additionally, is not only "NotRegistered" or canonical the only issues to cover on your server when you work with the response.

Please, read carefully this section to understand all scenarios and concrete tags that you must to implement on your 3rd party backend.

http://developer.android.com/google/gcm/http.html

In doubt, open another thread with the specifics and I'll be glad to help.

Regards,
Martin

Ritesh Paul

unread,
May 15, 2014, 1:24:30 PM5/15/14
to andro...@googlegroups.com
Thanks for your reply Martin. I am still in doubt about what you are saying. I am using the GCM http provided by google (https://code.google.com/p/gcm/source/browse/gcm-server/src/com/google/android/gcm/server/Sender.java) which parses Google's JSON response. Its  a standard code then why shouldnt it work? Am I doing anything wrong here?

Martin Revert

unread,
May 15, 2014, 3:16:52 PM5/15/14
to andro...@googlegroups.com

We'll, you're free to be un doubt of whatever you want.

I don't think that pure Google implementation is wrong.

Maybe your implementation based on that parser is wrong.

But this is easy to debug: If you didnt receive any error "NotRegistered" on the JSON response and failure equals zero, your problem is before your parser. The posible causes are mentioned above in this thread: Maybe your device is still informing that your app package is present or you are not waiting enough messages and time to let Google informs you the unregistration.

Gcmtest api

unread,
May 27, 2014, 3:26:35 AM5/27/14
to andro...@googlegroups.com
please check value of timeToLive   if it is default then may be after 4 weeks you will get ERROR_NOT_REGISTERED message.

Gcmtest api

unread,
May 27, 2014, 3:29:55 AM5/27/14
to andro...@googlegroups.com
Please check values when you are creating Message.Builder object . If you have not setiing timeToLive then default value is 4 week so may be you have to wait for 4 weeks to get ERROR_NOT_REGISTERED message.

Costin Manolache

unread,
May 27, 2014, 1:02:53 PM5/27/14
to andro...@googlegroups.com
AFAIK it is working as intended - can you send me the registration ID that you are testing with - I assume it is from an app 
that was installed at some point, then got uninstalled, and the device is still connected ?

The TTL has nothing to do with this - any value is fine.

When you send to an app that is uninstalled, few things may happen:
- device is disconnected - we save the message ( or if ttl=0, drop it )
- if device is connected, app uninstalled - message goes to the phone, phone sends back a message indicating the app is uninstaled which deletes the registration.
Next message will get the ERROR_NOT_REGISTERED
- device connected, app was re-installed - message delivered as if app was not uninstalled/re-installed

It may help to add few println in the library to print the response you get, or even better try it with curl commands.

Costin


--
You received this message because you are subscribed to the Google Groups "android-gcm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-gcm...@googlegroups.com.

To post to this group, send email to andro...@googlegroups.com.

Sudhakshina Girish

unread,
Dec 22, 2014, 5:23:54 AM12/22/14
to andro...@googlegroups.com

Hi Costin,
I am still  finding this issue. steps followed are :

1.  I installed my app. This registered it with the GCM Android Notifications Service and I received a registration id : APA91bG-CyR36gZySnZcvORdyF-XzqSqkmq9XX7c8tKdXH-eNkcEVjWFLNN52r7eS7k6EeOgvDwjWmbSQtDpJho4FWncD-a69pQOcLjaYBj7eyrqdcdGi2BCl-2t9ENbeYOtKBeY0YyXgMBarwDRuv7gT6a3FRdExw
2. I then uninstalled the app.
3. Sent a Notification - i do not get the NotRegistered  error. but as there was no application installed , the push was not handled.
4.Then I Re-installed the app, Now logging in as another user . this time, i was returned an Id :APA91bH-tmEVc_h2aXD1EHk9Z2aSy66fS4t-Jto9nTD4GC_i22q7jmqE82hE5bIEEdOBUjtGt_wGXVKgtfrgnk6ByTWofvoJIC1tqImWeox0AQC3aWUOcVJZRVIvUICOMt5tstaDTm8guN8eWwyp5QYFgzCSoYubDg
5. After Re-install, I continue to get notifications for both users( one before uninstall and the one after re-install.)



Please help me in resolving this issue.

Thanks

Thanks
Sudhakshina

Divya Rakesh

unread,
Jun 1, 2015, 7:15:12 AM6/1/15
to andro...@googlegroups.com
Hi Girish,

Did you get a fix for your issue?

Div

Costin Manolache

unread,
Jun 1, 2015, 9:52:23 PM6/1/15
to andro...@googlegroups.com

Marc Bernstein

unread,
Feb 9, 2016, 11:12:41 PM2/9/16
to android-gcm
Hi Costin - sorry to resurrect this thread, but I'm seeing some similar issues as described above. Is it expected to get a different token on subsequent calls to InstanceID.getInstance(Context).getToken(authorizedEntity, scope)? I'm on Android, using Google Play Services version 7.8.0, and when I uninstall/reinstall my app, I get a different token each time from this call.

Thanks,
Marc

Costin Manolache

unread,
Feb 9, 2016, 11:59:06 PM2/9/16
to andro...@googlegroups.com
Yes, uninstall should remove all tokens, and after install you will get a new token and ID. 

Costin

Reply all
Reply to author
Forward
0 new messages