What I want to create: An offline app that sends a text notification to user from the database (Room) once every 5 days at a random time. I test the app on my real device Redmi Note 7 (MIUI).
So I tried to use Alarm Manager and Work Manager for repeating task but it only worked right (even app is killed) if I enabled autorun and disabled buttery optimization for my application. Then I found out that many manufacturers like Xiaomi, Oppo, Huawei and similar restrict background work for apps.
I have 2 questions:
- What should I use to write reliable recurring notifications (not with foreground service) on every android device without requesting users to enable autorun and similar app settings?
- How apps like Twitter and Telegram sends notifications without enabling extra settings, although they use the internet unlike my app