问题描述
我的应用程序要求重复警报的计时非常准确。从API 19开始,AlarmManager setRepeating现在不精确以节省电池(保存树木和所有树木)。
My app requires very accurate timing of a repeating alarm. Since API 19 the AlarmManager setRepeating is now inexact to save battery ( Save the trees and all ).
是否有任何变通办法来使API 19的setExact方法在循环中工作?
Is there any workaround to get API 19's setExact method to work on a loop?
推荐答案
好的。让您的 BroadcastReceiver
或从警报中获得控制权的任何东西,调用 setExact()
安排下一次重复除了进行现有工作外。
Sure. Have your BroadcastReceiver
, or whatever is getting control from the alarm, call setExact()
to schedule the next recurrence, in addition to doing its existing work.
请记住,该可能会给您带来困难。
Bear in mind, though, that the changes to background processing in Android M may cause you difficulty.
这篇关于API 19及更高版本中AlarmManager setRepeating的替代方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!