I figured out this issue when I wasnt getting the notification through workmanager when the app was killed from background tasks in Android 10.
It is working fine for all the android version till Andorid 9. To test this, I run the app simultaneously on both 9 and 10 versions.
Is someone else also facing this issue? I searched the web but no support solution for Andorid 10 based issue.
Note: As soon as the app is opened and the workmanager is triggered, I get the notification in 10 but not when the app is completely closed. Also, I have tested this scenario on Google Pixel device as well for Android 10 but no success.
Guaranteed: The task runs even if the device restarts. Guaranteed work means that the task will run if the application process is killed or the device is restarted. Thus, an important example for WorkManager would be backing up pictures to a server.
At any point after enqueuing work, you can check its status by querying WorkManager by its name , id or by a tag associated with it. The query returns a ListenableFuture of a WorkInfo object, which includes the id of the work, its tags, its current State , and any output data set via Result. success(outputData) .
What is WorkManager. WorkManager is part of Android Jetpack and an Architecture Component for background work that needs a combination of opportunistic and guaranteed execution. Opportunistic execution means that WorkManager will do your background work as soon as it can.
Use WorkManager for reliable workWorkManager is intended for work that is required to run reliably even if the user navigates off a screen, the app exits, or the device restarts. For example: Sending logs or analytics to backend services. Periodically syncing application data with a server.
There is vast fragmentation in the android world. The background task management is the worst scenario as it will behave different in different devices. Please read the post below to get better understanding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With