Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8962153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:04:17+00:00 2026-06-15T16:04:17+00:00

My app uses gcm. Each time user logs in, new gcm token is registered

  • 0

My app uses gcm. Each time user logs in, new gcm token is registered and sent to my 3rd party server. Each time user logs out, gcm token is unregistered. This woks without any problems.

The problem is that when it comes to testing, tester can uninstall the app without loging out, and then install it back again and log into another account. Then he’ll recieve two gcms from two different account. This means he’ll recieve private gcms for account hes not currently loged into. This can even happen with live users sometimes.

GCM documentation states that gcm tokens can expire sometimes if the application is uninstalled. In practice, this never happens.
http://developer.android.com/google/gcm/gcm.html

GCM documentation also states that you can unregister GCM tokens by executing

Intent unregIntent = new Intent("com.google.android.c2dm.intent.UNREGISTER");
unregIntent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent(), 0));
startService(unregIntent);

But this method doesn’t seem to work if you try it after reinstall. I do recieve callback which tells me that token is unregistered, but gcm token still works ok.

My question is: can you ensure that there are no valid gcm tokens for your application? I’d really like to unregister all existing tokens during application first start, or at least reset them from the phone settings.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T16:04:19+00:00Added an answer on June 15, 2026 at 4:04 pm

    I believe you’ll receive an error when your server send a message to the invalidated registration id. I think you can catch this error to delete these registrations id from your database/datastore.

    Also from the doc (canonical id):

    If later on you try to send a message using a different registration
    ID, GCM will process the request as usual, but it will include the
    canonical registration ID in the registration_id field of the
    response. Make sure to replace the registration ID stored in your
    server with this canonical ID, as eventually the ID you’re using will
    stop working.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My app uses the iPodMusicPlayer and, when suspended, the user might go out and
I'm creating an app which uses Facebook and GCM. A user can use the
My App uses a modal view when users add a new foo. The user
My app uses a landscape only view and requires the user to answer a
My app uses a per-user session to allow multiple sessions from the same user
My app uses a logging class which is invoked by each module as it
My rails 3 app uses devise, and we have it set so a user
My Pylons app uses local MySQL server via SQLAlchemy and python-MySQLdb. When the server
My app uses a Dictionary protected _categoryToValueDict:Dictionary = new Dictionary(); to map something to
My app uses GPS. At first launch, user is asked if he want's to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.