问题描述
我已经使用 GCM
获取推送通知,现在如果我从 Android 设备上的设置中强制停止应用程序,它是否能够获取推送通知?
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.
有没有可能收到通知?
推荐答案
一旦您从设置"强制停止您的应用程序,您的代码将不会运行,直到有人手动运行您的组件之一(即用户手动启动活动).
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).
因此,从设置"强制停止您的应用后,您将不会收到 GCM 消息.
如果您想收到通知,您必须手动重启您的应用.
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.
这是自 Android 3.1 以来的设计.
处于停止状态的应用不会收到广播 Intent.
This is by design since Android 3.1.
Apps that are in the stopped state do not receive broadcast Intents.
停止状态为:
- 最初安装应用程序时(在用户运行某些应用程序之前应用程序)或
- 强制停止后.
您可以在此处找到更多相关信息:http://developer.android.com/about/versions/android-3.1.html#launchcontrols
You can find more about this here: http://developer.android.com/about/versions/android-3.1.html#launchcontrols
这篇关于应用强制停止后 GCM 推送通知是否有效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!