Nabeel
Nabeel

Reputation: 21

WorkManager is not working as intended in devices and some emulators

I've set the constraints as

val constraints = Constraints.Builder()
        .setRequiresCharging(true)
        .setRequiresDeviceIdle(false)
        .setRequiresBatteryNotLow(false)
        .build()

and created a OneTimeWorkRequest.

It starts the work inside the emulator with API 28 (android 9) as intended.

The problem is that on devices with Android 10 it doesn't starts the work even after I plugged in the charger. This also happens with android 10 emulators.

Upvotes: 1

Views: 1406

Answers (1)

Keivan.k
Keivan.k

Reputation: 638

Unfortunately this is the problem with some devices like Xiaomi, Huawei etc. They have set some restrictions that kill the background tasks. I've been struggling with this for days, and finally I found there is noway for doing this. You can only ask users to explicitly go to settings and change some of them in order to let the work manager work properly. you can find more info here: www.dontkillmyapp.com

Upvotes: 2

Related Questions