35

I have used GCM to get push notifications, now if I Force stop the app from the settings on the Android device, will it be able to get push notifications?

I have read many posts that say in this case an app cannot receive notifications.

Is there any possibility to get notifications?

Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
Yagnesh
  • 1,123
  • 3
  • 17
  • 27

1 Answers1

39

Once you force-stop your app from Settings, your code will not run until something manually runs one of your components (ie the user manually launches an activity).

Therefore after force-stopping your app from Settings, you will not receive GCM messages.
If you want to get notifications you have to manually restart your app.

This is by design since Android 3.1.
Apps that are in the stopped state do not receive broadcast Intents.

Stopped state is:

  • when the app is initially installed (before the user runs something in the app) or
  • after a Force Stop.

You can find more about this here: http://developer.android.com/about/versions/android-3.1.html#launchcontrols

David Gras
  • 958
  • 2
  • 12
  • 21
benka
  • 4,732
  • 35
  • 47
  • 58
  • But in our default message app receive messages ,after force stop it from settings option.could you please elaborate the reason why I am receiving message. – BABU K Nov 02 '14 at 18:15
  • I have manually started my application again... but GCM still doesn't work. I'm not sure what is actually going on. – Sandy D. Jul 17 '15 at 18:08
  • 2
    @dave , can you please tell me how come twitter is doing? As there is no service running in my phone for twitter as well as it also running in background. But still i am receiving the gcm calls how ? – UMESH0492 Aug 09 '15 at 00:20
  • I don't know @UMESH0492, this answer seems just the official Google answer. – David Gras Aug 10 '15 at 08:08
  • 1
    I'm having the same issue: 1) Force Stop the app 2) Send notification A 3) App the app (the notification A is not received) 4) Send notification B (The notification B is received but not A). @BABUK – JoseF Oct 25 '16 at 09:36
  • Whats happens when application get crashed? will it be able to get? – NitZRobotKoder Feb 21 '17 at 12:04
  • 2
    Sorry for the late question but, how facebook do this? I mean, if I force close facebook app right now, I still able to receive notifications. – Rod Lima Jun 22 '17 at 20:58
  • How to test the case? stoped but NOT by user. I can't wait for system stop it. – Stony Dec 14 '17 at 01:02