简体   繁体   English

如何在Android中以编程方式禁用省电模式

[英]How to disable power saving mode programmatically in android

我正在创建一个应用程序,该应用程序每分钟获取一次坐标并使用服务发送到服务器,但是当应用程序处于后台并且移动设备处于空闲模式时,它会终止我的服务,但是当电话不在省电模式时,它不会终止我的服务,由于这种情况,我必须禁用省电模式...

Unfortunately you can not do such thing. 不幸的是你不能做这样的事情。 And after Marshmallow android introduce Doze behavior for battery optimization which was the biggest halt seems in android for user check this out here . 在棉花糖android引入了Doze行为进行电池优化之后,这似乎是android中最大的停顿现象,供用户在此处查看

Please read the above link first before approaching further. 在继续之前,请先阅读以上链接。 And for more information the power saver mode behavior varies device to device. 有关更多信息,省电模式的行为因设备而异。 I myself tested in Samsung Grand and lenovo Vibe devices . 我本人已在Samsung Grand和联想Vibe设备中进行了测试。 Some of Devices will not allow services in background and any network access to the application. 一些设备将不允许后台服务,也不允许任何网络访问该应用程序。 You can find work around for the problem in android documentation in above link 您可以在上述链接的android文档中找到解决该问题的方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM