Created
May 24, 2020 16:07
-
-
Save tobioyelekan/6c2e36a7f5d5758a0be5cd86759a8dc2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationClass : Application() { | |
override fun onCreate() { | |
super.onCreate() | |
val constraint = Constraints.Builder() | |
.setRequiredNetworkType(NetworkType.CONNECTED) | |
.build() | |
val workManager = WorkManager.getInstance(applicationContext) | |
val request = PeriodicWorkRequest.Builder(WorkManagerClass::class.java, | |
PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS, TimeUnit.MINUTES) | |
.setConstraints(constraint) | |
.build() | |
workManager.enqueue(request) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment