Android periodic work friendly to doze mode and app standby

Multi tool use
Multi tool use


Android periodic work friendly to doze mode and app standby



I'm trying to found a best way to perform periodic work in android that will play nicely with doze mode and app standby.
I've tried WorkManager with periodic request, it works fine at the beginning (for 15 mins requests) but the time slots diminishes as time goes by, after a week its seems to get triggered only once per day.



What is the best way to get the required behavior and still be doze mode and app standby friendly?





If you have a server I think FCM this is your best option: developer.android.com/training/monitoring-device-state/…
– Hed Shafran
Jul 1 at 10:44





I thought about it(FCM), but after reading the FCM documentation, I've decided it's not the way, in docs it's stated ". High priority messages generally should result in user interaction with your app. If FCM detects a pattern in which they don't, your messages may be de-prioritized."
– Dima
Jul 1 at 11:01





I also read that, so don't use high-priority, I think it's still your best option... when you get the push, enqueue a OneTimeWorkRequest , it will be triggered when the system decides (maybe immediately), but it will trigger eventually. In my app I use both PeriodicWorkRequest and OneTimeWorkRequest triggered by FCM, they both trigger the same work.
– Hed Shafran
Jul 1 at 11:46


OneTimeWorkRequest


PeriodicWorkRequest


OneTimeWorkRequest





Do you need network access?
– Hed Shafran
Jul 1 at 11:51





In some of the case I do need network access. How often do you send your FCM messages? Doesnt it violate google policies ?
– Dima
Jul 1 at 12:23









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

GdGZk1CxmzuczbHFVf4lD,NlRnEM54Cv2DsQr,HSYoJjb1VT5ckF QS 1H
i5IvTV fS6RMlr lkcik15c0pcQA999zKdHu BvbP,fDpxv GD,PKpyuNo4ZnQYpEf3VyqCyUgLE 4R2XdqP aWPmXb v1 yB6Ol aE,tO

Popular posts from this blog

Rothschild family

Cinema of Italy