碰巧活动/服务什么时候手机进入休眠/待机模式? [英] What happens to Activities/Services when phone goes to sleep/standby mode?

查看:138
本文介绍了碰巧活动/服务什么时候手机进入休眠/待机模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

恰好的Andr​​oid应用程序,属于应用程序的时候,手机/ AP进入睡眠模式?请问框架破坏活动和服务,操作系统杀死进程?活动和服务是什么

What happens to android application and activities and services that belongs to application when the phone/AP goes to sleep mode?Will the framework destroy Activities and Services and OS kills the process?

推荐答案

在设备的情况下睡眠,活动的`的onPause()'将被调用。阅读活动周期明白这一点。

In case of device sleep, activity's `onPause()' will be called. Read activity lifecycle to understand this.

OS只杀死时,内存/资源不足的过程。活动首先被杀,服务只打死最后的手段。

OS only kills the process when memory/resources are low. Activities are killed first, services are only killed as last resort.

不过,也不能保证他们就不会被撞死。这就是为什么你应该依靠系统服务给你打电话时,你需要完成一些工作:用AlarmManager做ç定期打电话给你的$ C $,或使用监听器通知系统的变化(全球定位系统,网络等),你

But there is no guarantee they will not be killed. This is why you should rely on system services to call you when you need some work done: use AlarmManager to do call your code periodically or use listeners to notify you of system changes (gps, network, etc..)

这篇关于碰巧活动/服务什么时候手机进入休眠/待机模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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