0
JobInfo.Builder有一个设置设备闲置状态的方法,但是我很困惑它到底想说什么。如何仅在设备未打瞌睡时才使用JobScheduler计划作业(甚至不包括“维护”窗口)?
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使其仅在维护窗口中运行并且在其他情况下不会运行?
我希望它当设备被激活的特别使用...只有当它活跃时。 – Kushan
但是,在维护窗口中运行的作业也存在什么问题? – arjun
问题是如果我将该死的标志设置为true,它只会在维护窗口中运行,并且如果仅在活动状态下为false ...那就是为什么没有mw。建议一些东西,如果你有其他 – Kushan