gpt4 book ai didi

android - setAndAllowWhileIdle 和 setExactAndAllowWhileIdle 的区别

转载 作者:太空狗 更新时间:2023-10-29 14:50:40 28 4
gpt4 key购买 nike

AlarmManager.setAndAllowWhileIdle()AlarmManager.setExactAndAllowWhileIdle() 有什么区别?这两者如何影响 Android 6.0 (Marshmallow) API 中引入的打盹模式?

最佳答案

引用AlarmManager的文档:

Note: Beginning with API 19 (KITKAT) alarm delivery is inexact: the OS will shift alarms in order to minimize wakeups and battery use. There are new APIs to support applications which need strict delivery guarantees; see setWindow(int, long, long, PendingIntent) and setExact(int, long, PendingIntent). Applications whose targetSdkVersion is earlier than API 19 will continue to see the previous behavior in which all alarms are delivered exactly when requested.

事实上,您提到的两种方法都指定它们的行为与没有“AndAllowWhileIdle”(setsetExact)的对应方法一样。因此,其中一个会在准确的时间发出警报,而另一个则不准确。

关于android - setAndAllowWhileIdle 和 setExactAndAllowWhileIdle 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35666127/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com