Skip to content

Commit

Permalink
RELEASE_VERSION_8.2 (#104)
Browse files Browse the repository at this point in the history
* - uncomment payload

* - workers with optional notifications
  • Loading branch information
evilthreads669966 authored Jan 1, 2021
1 parent 9d65f34 commit ac6b72e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ allprojects {
2. Add the dependency to your app's build.gradle
```gradle
dependencies {
implementation 'com.github.evilthreads669966:bootlaces:8.1'
implementation 'com.github.evilthreads669966:bootlaces:8.2'
implementation "com.google.dagger:hilt-android:2.29.1-alpha"
kapt "com.google.dagger:hilt-android-compiler:2.29.1-alpha"
}
Expand Down Expand Up @@ -63,6 +63,16 @@ class WorkerWithReceiver: Worker(666,"Locking the screen"){
//do work
}
}
//worker with a progress notification
class MyProgressWorker: Worker(66,"Working while displaying a notification for progress") {
override val receiver: WorkReceiver?
get() = null

override suspend fun doWork(ctx: Context) {
for(i in 1..10)
delay(1000)
}
}
```
7. Inject your WorkScheduler inside of an Android context
```kotlin
Expand All @@ -76,6 +86,9 @@ scheduler.schedulePersistent(WorkerWithReceiver())
//one time worker
scheduler.scheduleOneTime(MyWorker())

//one time worker with notificaton for displaying progress. This works for all scheduler methods
scheduler.scheduleOneTime(MyProgressWorker())

//periodic worker
scheduler.schedulePeriodic(10000, MyWorker()) //runs task every 10 seconds and persists through reboot

Expand Down

0 comments on commit ac6b72e

Please sign in to comment.