0
votes

I use iOS GCM. After reinstalling the application I receive notification that the application has been signed with the old token.

Steps to reproduce:

  1. Install app get GCM token: [[GGLInstanceID sharedInstance] tokenWithAuthorizedEntity:_gcmSenderID scope:kGGLInstanceIDScopeGCM options:_registrationOptions handler:_registrationHandler]; Subscribe to a topic: [[GCMPubSub sharedInstance] subscribeWithToken:yourRegToken topic:@"/topics/sample-topic" options:nil handler:^void(NSError *error) { if (error) { int code = error.code; // handle the error, perform exponential backoff // to retry } else { // subscribe successful } }];
  2. After send push, app receive one push

  3. Delete app

  4. Install app again get GCM token Subscribe to a topic
  5. After send push, app receive two push!!!!!

Why I've got two push-notifications? How to unsubscribe from the old subscription?

Thanks in advance.

1
Topic is associated with registration token, every time you reinstall your app, you should get a new registration token, and your device will have only one token for your app. So you should not receive push notification twice, because your app only has one token. I tried to reproduce the issue with your provided steps, but I only receive one notification. It is possible that your old notification was delay, and when you send a new one, your app shows 2 notifications. Also, you can provide your HTTP request in your question.ztan
But if I delete app and install app again I've got new token every time...valerybodak
Yes, every time you reinstall your app, you will get a new token, but your app wont obtain the old one.ztan

1 Answers

0
votes

This seems like a bug in GCM. Somehow the old registrations subscribed to a topic are not getting cleaned up when you delete the app. You should file a bug here https://github.com/google/gcm/issues.