• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

AlarmManager not working for 5 minutes periodic update

steoliveira

Lurker
Aug 31, 2023
2
1
In my application I was using the setRepeating method of the AlarmManager class to perform the data update every 5 minutes. But in newer versions this logic started to have problems triggering the alarm. Searching, I saw that this method is not accurate, due to the concern of optimizing the battery on the part of the OS. I saw that there are methods like setExact and setExactAndWhileIdle, they are not as exact as the name suggests, because they admit a certain delay, mainly when the device is inactive. WorkManager I cannot use because I am dealing with a time of 5 minutes and the minimum of it is 15 minutes. Unfortunately, this time is not flexible, I need it to be 5 minutes and allow exact updating even with the device inactive. Is there any way to achieve this behavior?
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones