This is my note for Udemy lesson: Advanced Android Bootcamp 2024.
1. Read Work Manager - One Time Request
2. Write Function
private fun setPeriodicWorkRequest() { val periodicWorkRequest = PeriodicWorkRequest .Builder(UploadWorker::class.java, 15, TimeUnit.MINUTES) .build() WorkManager.getInstance(applicationContext).enqueue(periodicWorkRequest) }
Then the task will be executed every 15 minutes.