May 2022
Intermediate to advanced
688 pages
20h 12m
English
The Worker class is where you will put the logic you want to perform in the background. Once your worker is in place, you will create a WorkRequest that tells the system when you would like your work to execute.
Before you can add your worker, you first need to add the appropriate dependency in app/build.gradle.
Listing 22.1 Adding the WorkManager dependency (app/build.gradle)
dependencies {
...
implementation "androidx.datastore:datastore-preferences:1.0.0"
implementation 'androidx.work:work-runtime-ktx:2.7.1'
...
}
Do not forget to sync your files after you add the dependency.
With your new library in place, set up your Worker. Like several of the libraries you have used so far, the WorkManager ...
Read now
Unlock full access