Search code examples
android-workmanager

Cannot initialize WorkManager in direct boot mode


I am new to WorkManager and I have a question about storage protection. Tip: Cannot initialize WorkManager in direct boot mode. I searched for a long time to find that:

AndroidManifest.xml

 <application
     android:defaultToDeviceProtectedStorage="true"
     android:directBootAware="true">

My app is a boot start, so I need these two properties, but I don't know how to solve this problem, I can't find the entry that has the problem of configuring WorkManager storage.

I don't know what to do now, can't I use WorkManager?


Solution

  • update workmanager with 2.7.1 and implement ondemand initialization it should work. please remove workmanger initialization from manifest file- provider android:name="androidx.startup.InitializationProvider" android:authorities="${applicationId}.androidx-startup" tools:node="remove"> provider