打ze模式-前台服务是否继续运行? [英] Doze mode - do foreground services continue to run?

查看:97
本文介绍了打ze模式-前台服务是否继续运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困惑阅读此书,并试图弄清楚当设备进入深度打ze模式时前台服务是否将运行.有人可以澄清.我想知道棉花糖和棉花糖是否可以继续运行.我一直以为设备休眠时所有线程都被挂起,即使是前台服务也被挂起.

im so confused reading this and trying to figure out if foreground services will run when the device goes into deep doze mode. Could someone clarify. I want to know on marshmallow and upwards if foreground services can continue to run. I always thought ALL THREADs are suspended even foreground services when device sleeps.

我看到了

I see the doze mode restrictions but nothing about foreground services. im so confused if my services outlives doze mode security settings.

据我所知,在打ze模式限制下,仅网络呼叫停止了.但是可以说我正在做一些长时间运行的主线程工作,这意味着它可以继续正常运行吗?即使在打ze睡模式下?

From what i can tell in the doze mode restrictions just network calls are stopped. But lets say i was doing some long running main thread work, it means it can continue to run right ? even in doze mode ?

推荐答案

前台服务在休眠模式下不会终止,这是覆盖休眠模式的一种很好的解决方法. 终止前台服务在很大程度上取决于Mobile OS. 像华为一样,它会在很短的时间后终止前台服务,您将无法确定期限. 如果其他一些电话检测到意外的电池消耗,则会终止最旧的前台服务. 去年,我花了大约6个月的时间观察手机是否在打do模式激活或不激活的情况下杀死前台服务. 我尝试了一种以上的解决方案来覆盖打seconds模式,即每10秒检测一次位置,最好的一种是前台服务. 因此,在某些手机上您将面临意外的行为,但这是打ze睡和待机模式的最佳解决方案. 您可以看到此文章 并且您也可以查看此教程

Foreground services do not kill in doze mode and it's a great workaround to override the doze mode. Killing the foreground service is highly depending on Mobile OS. Like Huawei, it kills the foreground services after a slack of time and you will not be able to determine the period. Some other phones kill the oldest foreground service if it detects unexpected battery consumption. last year, I spent around 6 months observing phones behavior in killing the foreground services when doze mode is activated or not. and I tried more than one solution to override the doze mode in detecting location every 10 seconds and the best one is the foreground service. So you will face unexpected behavior on some phones but it is the best solution for doze and standby mode. You can see this article and you can also look at this tutorial

这篇关于打ze模式-前台服务是否继续运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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