Skip to content

Instantly share code, notes, and snippets.

@molidev8
Created August 4, 2022 09:43
Show Gist options
  • Save molidev8/f9a63944ede7b6e7e14d0628fe3887ac to your computer and use it in GitHub Desktop.
Save molidev8/f9a63944ede7b6e7e14d0628fe3887ac to your computer and use it in GitHub Desktop.
Specifiying the worker job
class BackupWorker(
context: Context,
workerParams: WorkerParameters
) : CoroutineWorker(context, workerParams) {
private val backup: BackupUserData = BackupUserData(applicationContext)
override suspend fun doWork(): Result {
return if (backup.doBackup()) Result.success()
else Result.failure()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment