Skip to content

Instantly share code, notes, and snippets.

@kasem-sm
Created May 30, 2022 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kasem-sm/803aced03a405066437e40e4accb466f to your computer and use it in GitHub Desktop.
Save kasem-sm/803aced03a405066437e40e4accb466f to your computer and use it in GitHub Desktop.
When Jetpack's Glance met his fellow worker, Work Manager
override suspend fun doWork(): Result {
val article = api.getFromUsersSubscription().mapToEntity()
return try {
// Update the widget's text content.
// suspending function
updateWidget(article.title, context)
Result.success()
} catch(e: Exception) {
Result.retry()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment