WorkManager doWork callback is not received in Redmi and other custom Chinese ROM when device got rebooted and force closed the app

前端 未结 4 2128
梦毁少年i
梦毁少年i 2021-02-11 00:25

My app is not receiving push notification in Redmi phones while the app is in the background or it got killed by swiping.

So I am trying to wake the phone by WorkManage

相关标签:
4条回答
  • 2021-02-11 00:47

    WorkManager API will work well as documented in the Android Stock OS devices or emulator. Customised ROMs like Xiaomi, Vivo, etc. have the Battery Saver option set to "optimized" by default, and don't allow the WorkManager API as expected. Set Battery Saver to "no restrictions" and your WorkManager will run the task.

    I am using version 1.0.1 and it works well with Xiaomi devices after performing the above changes for Battery Saver.

    0 讨论(0)
  • 2021-02-11 00:50

    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <uses-permission android:name="android.permission.WAKE_LOCK" />

    Add these permissions in your manifest file it may work.

    0 讨论(0)
  • 2021-02-11 00:57

    Please also take a look at this Xiaomi, Vivo, Oppo and huawei restrict background services by default. After applying this solution my WorkManager also started to work.

    0 讨论(0)
  • 2021-02-11 01:05

    Which version of WorkManager are you using ? We fixed a few bugs with respect to PeriodicWork and force-stopping of apps in alpha05. alpha06 is out, and I recommend you try using it. If you still have the same problem, please report back on the issue tracker with a reproducible test case on the issue tracker.

    0 讨论(0)
提交回复
热议问题