如果Android杀了我的应用程序,并且如果我从设置强制关闭,我会收到GCM消息吗? [英] Will I receive GCM messages if Android kill my app and if I do a Force Close from the settings?

查看:99
本文介绍了如果Android杀了我的应用程序,并且如果我从设置强制关闭,我会收到GCM消息吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Android开发的新手,我对与Google云消息传递有关的两件事感兴趣。


  1. 如果iOS在后台运行很长时间,Android绝对会杀死应用程序?如果是的话,我的应用程序被Android杀死后会收到GCM通知?

  2. 强制关闭(来自设置菜单)与应用程序被Android杀死时有区别吗?如果我强制关闭,我会收到GCM通知吗?


解决方案

<1>如果你在你的清单中安装一个监听gcm的广播接收器,它将会被触发。你会用这个事件做什么取决于你的应用程序。通常的做法是启动处理消息的意图服务。这取决于您与应用程序的活动进行交互。

2 - 从android 3.1开始,如果用户强制关闭您的应用程序,它将停止通知任何广播直到用户没有再次启动您的应用程序。点击此处查看在停止的应用程序上启动控件以获取更多详细信息。

I'm a newbie to Android development and I'm interested in two things which is connected to Google Cloud Messaging.

  1. Does Android absolutely kill applications if they run for a long time in background as iOS does? And if so will I receive GCM notifications after my app was killed by Android?
  2. Is there some difference between Force Close (from the settings menu) and when the app is killed by Android? And if I do Force Close will I receive GCM notifications?

解决方案

1 - yes, but if you install in your manifest a broadcast receiver that listens for the gcm, it will triggered anyway. What you will do with that event depends on your app. A common practice is to start an intent service that handles the message. It's up to you to make interact with the activities of your app.

2 - From android 3.1, if the user force closes your app, it will stop to be notified of any broadcast until the user does not start your app again. Check "Launch controls on stopped applications" here for more details.

这篇关于如果Android杀了我的应用程序,并且如果我从设置强制关闭,我会收到GCM消息吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆