How can I receive notifications from GCM when application is stopped

后端 未结 2 1348
孤街浪徒
孤街浪徒 2020-12-05 11:54

GCMIntentService (extends GCMBaseIntentService) doesn\'t receive notifications if the application is not running.

From : http://developer.android.com/about/versions

2条回答
  •  爱一瞬间的悲伤
    2020-12-05 12:49

    GCMIntentService (extends GCMBaseIntentService) doesn't receive notifications if the application is not running.

    Yes, it will. The rest of your question, though, has little to do with whether the application is running, but rather whether it has been run by the user before. What the word "stopped" means in the paragraph you quote is not "not running", but represents a state that an application is in:

    • when it is first installed, before something manually invokes a component (e.g., user launches an activity)

    • after the user force-stops the app, until something manually invokes a component (e.g., user launches an activity)

    (and I really really wish they had come up with a more distinctive adjective than "stopped" for this...)

    Is there a way to get around this setting?

    No. If the user force-stops your app, they are indicating that they do not want your app to run again, for any reason, until they manually launch it again. Your objective is to give the user no reason to force-stop your app. Note that I do mean "force-stop" (i.e., press the "Force Stop" button from Settings) -- ordinary task managers, or swiping from the Recent Tasks list in Android 4.x, does not have this effect.

提交回复
热议问题