Android SDK WorkManager

ENGAGE® Android SDK WorkManager

The ENGAGE SDK uses WorkManager for job scheduling. ENGAGE SDK will initialize a default WorkManager if one does not exist. If the host app already uses WorkManager, measures should be taken to guard against an already initizied state.

WorkManager 2.5.0 or lower

If the host app uses WorkManager 2.5.0 or lower, there will be no limit on usage of WorkManager functionalities except when attempting to initialize WorkManager. Therefore WorkManager.initialize() should not be called in the host app.


WorkManager 2.6.0 or higher

If the host app uses WorkManager 2.6.0 or higher, the following code must be added in the AndroidManifest.xml :


When host app uses androidx.startup

<provider
    android:name="androidx.startup.InitializationProvider"
    android:authorities=\"${applicationId}.androidx-startup"
    android:exported="false"
    tools:node=\"merge" >
    
    <!--If you are using androidx.startup to initialize other components -->
    <meta-data
        android:name="androidx.work.impl.WorkManagerInitializer"
        android:value="androidx.startup"
        tools:node="remove" />
</provider>

When host app does not use androidx.startup

Work Manager 2.6.0 should not call WorkManager.initialize() in the host app.

<!--If you want to disable android.startup completely. -->
<provider
    android:name="androidx.startup.InitializationProvider"
    android:authorities="${applicationId}.androidx-startup"
    tools:node="remove">
</provider>

What’s Next