Skip to content

Commit

Permalink
release version 8 (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilthreads669966 authored Dec 31, 2020
1 parent 7db6863 commit 3d490c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions 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:7.0'
implementation 'com.github.evilthreads669966:bootlaces:8.0'
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 @@ -68,12 +68,19 @@ class WorkerWithReceiver: Worker(666,"Locking the screen"){
```kotlin
@Inject lateinit var scheduler: WorkScheduler
```
8. Choose a persistent worker or a one time worker. A persistent worker will cause your service to start at boot and run the worker.
8. Schedule your worker
```kotlin
//persistent worker
scheduler.schedulePersistent(WorkerWithReceiver())

//one time worker
scheduler.scheduleOneTime(MyWorker())

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

//future worker
scheduler.scheduleFuture(5000, MyWorker()) //runs task once in 5 seconds and persists through reboot if device is restarted before
```
## Important To Know
- You can schedule as many workers as you want both persistent and one time workers.
Expand Down
4 changes: 2 additions & 2 deletions bootlaces/src/main/java/com/candroid/bootlaces/WorkDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ import javax.inject.Singleton
@Dao
interface WorkDao{

@Query("SELECT * FROM work WHERE interval IS NULL")
@Query("SELECT * FROM work WHERE interval IS NULL AND delay IS NULL")
fun getPersistentWork(): Flow<Work>

@Query("SELECT * FROM work WHERE interval IS NOT NULL")
@Query("SELECT * FROM work WHERE interval IS NOT NULL AND delay IS NULL")
fun getPeriodicWork(): Flow<Work>

@Query("SELECT * FROM work WHERE delay IS NOT NULL AND interval IS NULL")
Expand Down

0 comments on commit 3d490c4

Please sign in to comment.