如何保持从'睡觉'时,屏幕在Android中关闭CPU? [英] How to keep CPU from 'sleeping' when screen is turned off in Android?

查看:342
本文介绍了如何保持从'睡觉'时,屏幕在Android中关闭CPU?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在哪,我通过WiFi网络发送数据的应用程序。一切都很好,直到我关闭显示屏或设备进入睡眠。我已经但是锁定无线网络,它的似乎的是,当在睡眠状态下会导致CPU速度斜坡下我流不检点(即包不流一样快,我的情况下,想,因为它们在设备不睡觉做)。

I have an application in which I am sending network data over WiFI. Everything is fine until I turn the display off or the device goes to 'sleep'. I'm already locking the WiFi however, it seems to be the case that the CPU speed ramps down when in sleep which causes my streaming to not behave properly (i.e. packets don't flow as fast as I would like as they do when the device is not sleeping).

我知道我可能可以/可能要解决这个问题在协议层面但是,的有可能会不的可能,以及...

I know that I possibly can/possibly should address this at the protocol level however, that might possibly not be possible as well...

有没有的任何的从去'睡觉',当屏幕关闭时prevent的CPU?如果是这样,怎么样?如果不是,就如何保持我的无线网络速度的任何意见流相一致的设备是否处于睡眠模式或不?

Is there any way to "prevent the CPU from going to 'sleep' when the screen is off"? If so, how? If not, any advice on how to keep the speed of my WiFi stream consistent whether the device is in sleep mode or not?

推荐答案

好了,所以,经过更多的研究和试验,似乎的真正的问题是事实,至少在一些手机,他们的无线网络进入了部分睡眠模式的即便的你已经采取了WiFi锁。看来,这就是WIFI_MODE_FULL_HIGH_PERF'标志的发明采取了WiFi锁的时候......不幸的是,这个标志是仅适用于某些设备/ Android的版本(我不知道哪个,但它是不可用对我来说)。如此,因此,它不是对所有的设备的修复

Okay, so, after much more research and experimenting, it seems that the real issue is the fact that, at least on some phones, their WiFi goes into a 'partial sleep' mode EVEN IF you've taken the WiFi lock. It seems that this is what the 'WIFI_MODE_FULL_HIGH_PERF' flag was invented for when taking the WiFi lock... unfortunately, this flag is only available on some devices/Android versions (I have no clue as to which but, it wasn't available to me). So, therefore, it isn't a fix for all devices.

唯一的解决方案(这实际上是一个杂牌组装电脑)似乎是发现当屏幕处于关闭状态,然后,设置闹钟,轮流在屏幕的背面上紧随其后。这有助于一点点与此链接:

The only "solution" (which is actually a kludge) seems to be to 'detect when the screen is turned off and then, set an alarm that turns the screen back on immediately thereafter'. The links that helped a little bit with this are:

如何手机休眠后保持一个任务活着?

<一个href="http://android.modaco.com/topic/330272-screen-off-wifi-off/">http://android.modaco.com/topic/330272-screen-off-wifi-off/

我希望这有助于人们谁遇到无线干扰的时候,手机进入睡眠/关闭屏幕(和手机被拔掉/断开[例如,你将看不到这种效果,当连接到亚行; 只有的手机时,什么也没有连接到它的运行])。

I hope that this helps people who are experiencing WiFi disruption when the phone goes to sleep/screen is turned off (and the phone is unplugged/disconnected [e.g. you won't see this effect when connected to adb; only when the phone is running with nothing connected to it]).

这篇关于如何保持从'睡觉'时,屏幕在Android中关闭CPU?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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