novoda / download-manager

A library that handles long-running downloads, handling the network interactions and retrying downloads automatically after failures
Apache License 2.0
483 stars 63 forks source link

NOS-521: Migrate to WorkManager #532

Closed ouchadam closed 4 years ago

ouchadam commented 4 years ago

Moves away from https://github.com/evernote/android-job in favour of WorkManager #521

Breaking change clients must provide a DelegatingWorkerFactory for the library to inject its own factory into, otherwise network recovery will not work

ConfigurationException will be thrown if the DelegatingWorkerFactory is not found on the application.

public class MyApplication extends Application implements Configuration.Provider {
    private final  Configuration workManagerConfig = new Configuration.Builder()
            .setWorkerFactory(new DelegatingWorkerFactory())
            .build();
    @Override
    public Configuration getWorkManagerConfiguration() {
        return workManagerConfig;
    }
}

This functionality has been used in production for about 6 months without issue from my my side 🌻

Network recovery

after-dlm