Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WorkManager not working when app killed in Android 10 although working fine till version 9 (Pie)

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.

like image 988
Prajwal Waingankar Avatar asked Jul 29 '20 06:07

Prajwal Waingankar


People also ask

Does WorkManager work when app is killed?

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.

How can I tell if WorkManager is running on Android?

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) .

Does Work Manager work in background?

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.

When would you use a WorkManager?

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.


1 Answers

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.

  • https://medium.com/mindorks/enable-background-services-in-chinese-roms-32e73dfba1a6
  • http://pguardiola.com/blog/darealfragmentation-alarms/
like image 163
abdul rehman Avatar answered Oct 05 '22 03:10

abdul rehman