element-hq / element-hq/element-android

WorkManager: iterate on the initialization process

Open
#1,014 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
3.7k
Forks
917
PR merge metrics
No merged PRs in 30d

Description

A warning in the documentation of the library is:

> Note that on-demand initialization may delay some useful features of WorkManager such as automatic rescheduling of work following a crash and recovery from the application being force-stopped by the user or device.

```
/**
* A class that can provide the {@link Configuration} for WorkManager and allow for on-demand
* initialization of WorkManager. To do this:
*


    *
  • Disable {@code androidx.work.impl.WorkManagerInitializer} in your manifest

  • *
  • Implement the {@link Configuration.Provider} interface on your
    * {@link android.app.Application} class

  • *
  • Use {@link WorkManager#getInstance(Context)} when accessing WorkManger (NOT
    * {@link WorkManager#getInstance()})

  • *


*


* Note that on-demand initialization may delay some useful features of WorkManager such as
* automatic rescheduling of work following a crash and recovery from the application being
* force-stopped by the user or device.
*
* @see WorkManager#initialize(Context, Configuration) for manual initialization.
*/
public interface Provider {

/**
* @return The {@link Configuration} used to initialize WorkManager
*/
@NonNull Configuration getWorkManagerConfiguration();
}
```

It makes me think that we should not initialize the work manager, but let the lib do it.

Also #1012 is a thing

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.