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 8987447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:47:44+00:00 2026-06-15T21:47:44+00:00

I have GCM completely working. My question is when I exit my app with

  • 0

I have GCM completely working. My question is when I exit my app with the android BACK key I see the onDestroy() called and to avoid leaks I unregistered the receiver for gcm so it’s onUnregister() is called. But I want to be able to register gcm once at power up (boot completed?) and then be able to get notifications any time. I know I will need to still handle when google may refresh the reg intent. But I’m not clear if I need to make a new service to register gcm in in its onCreate()? Right now I register gcm in the main activity’s onCreate().

Thanks for any help!!

Justin

  • 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-15T21:47:45+00:00Added an answer on June 15, 2026 at 9:47 pm

    Without looking at your code it’s a bit hard to tell, but you should not be unregistering from GCM every time you leave the app. A typical GCM App life-cycle (if you are using the GCM jar) would be the following:

    1. App starts and checks to see if it has a GCM registrationID (which means that it registered with GCM) then checks to see if it has registered with your server.
    2. If it has a registrationID but has not registered with your server it attempts to do that.
    3. If it does not have a registrationID it attempts to register with GCM, and then when it gets the registrationID it will attempt to register with your server

    Number 4 would probably be unregistered from GCM when they turned off a preference to unregister from receiving notifications.

    Take a look at Google’s Client sample DemoActivity: http://code.google.com/p/gcm/source/browse/samples/gcm-demo-client/src/com/google/android/gcm/demo/app/DemoActivity.java

    Notice that they do not unregistered from GCM. If you follow their sample you will receive notifications after the device powers up without having to do anything else yourself.

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

Sidebar

Related Questions

I have a demo of gcm working here: http://leobee.com/android/push/login/gcm/updateusers.php If you refresh the page,
I have two android devices that runs a gcm client app. I get the
I have successfully implemented a client/server Android GCM application. My app server holds a
I was trying to use GCM to have push-notification in my app. I called
I have migrated my app to use the new GCM push system. It works
Building an Android application using Google's GCM service. I have implemented the onRegistered method
I am trying to create a sample app for Android which can have push
I have this exception: java.lang.NoSuchMethodError: android.app.Notification$Builder.setProgress at android.support.v4.app.NotificationCompatIceCreamSandwich.a dd(NotificationCompatIceCreamSandwich.java:31) at android.support.v4.app.NotificationCompat$NotificationCompatImplIceCreamSandwich.build(NotificationCompat.java:104) at android.support.v4.app.NotificationCompat$Builder.build(NotificationCompat.java:558) at
I have gotten some strange StackTraces from users of my app recently: Android Version:
So i have implemented GCM into my app with help of the AndroidHive tutorial.

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.