'Use WorkManager to wake up the app and process low priority FCM push notifications
I have implemented Push notifications using Firebase, but because I need control over how the notifications are displayed, I have to resort to sending data only notifications from my server and then show a local notification based on the data received. Everything works fine as long as I'm running my app on stock or near-stock android devices.
The problem happens when I run my app on devices like OnePlus, Huawei or Redmi. These devices add additional battery restrictions due to which my push notifications aren't displayed until the user opens the app. I can turn off battery optimizations to overcome this but it's not a good solution.
What I'm trying to achieve right now is to somehow use WorkManager or AlarmManager to wake up the app periodically and let it process the pending notifications. This is where I'm stuck. I have implemented a repeating WorkManager task to show a short duration persistent notification like WhatsApp's "Checking for new messages" notification. But I don't understand how do I "pull" the pending notifications or let the application wake up to process the notifications.
I'm building an application using Flutter workmanager 0.5.0-dev.8
Any suggestions/leads would be very helpful. Thank you for your time!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
