[英]AlarmManager doesn't works properly
I programatically set fire AlarmManager every 10 seconds, This code works on all devices except the one I relly need.我以编程方式每 10 秒设置一次 AlarmManager,此代码适用于除我真正需要的设备之外的所有设备。
On this device it calls every 60 seconds在此设备上,它每 60 秒调用一次
Question: is there any limitation/configuration settings ?问题:是否有任何限制/配置设置?
alarmMgr.setInexactRepeating(AlarmManager.RTC_WAKEUP, SystemClock.elapsedRealtime(), 10000, alarmIntent);
您可以使用Handler
或Executors
或TimerTask
As mentioned on https://developer.android.com/reference/android/app/AlarmManager.html newer android OS versions will mess up with your intervals.正如https://developer.android.com/reference/android/app/AlarmManager.html 上提到的,较新的 android 操作系统版本会扰乱您的时间间隔。 If you need exact timing you should use SetWindow or SetExact
如果您需要精确计时,您应该使用 SetWindow 或 SetExact
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.