【发布时间】:2017-02-24 14:05:38
【问题描述】:
JobInfo.Builder 有一种设置设备空闲状态的方法,但我对它到底想说什么感到困惑。
setRequiresDeviceIdle (boolean requiresDeviceIdle)
Specify that to run, the job needs the device to be in idle mode. This defaults to false.
Idle mode is a loose definition provided by the system, which means that the device is not in use,
and has not been in use for some time. As such, it is a good time to perform resource heavy jobs.
Bear in mind that battery usage will still be attributed to your application, and surfaced to the user in battery stats.
现在对布尔值的描述如下:
requiresDeviceIdle boolean: Whether or not the device need be within an idle maintenance window.
我基本上需要在设备不打瞌睡时启动作业,最好甚至在维护窗口中也不要。这项工作的目的是从网络上下载东西。
将其设置为 false 是否会导致它在设备不在维护窗口中时运行? (实际深度睡眠状态IDLE和运行状态)
将其设置为 true 是否会导致它仅在维护窗口中运行而在其他情况下不运行?
【问题讨论】:
-
setRequiresDeviceIdle()不是打盹模式空闲状态。这只是意味着屏幕已关闭。检查官方文档。 developer.android.com/reference/android/app/job/…
标签: android