Skip to content

Instantly share code, notes, and snippets.

@Arunshaik2001
Created November 20, 2022 16:10
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 Arunshaik2001/b691035babea7d5cff6e4f5c66dbc580 to your computer and use it in GitHub Desktop.
Save Arunshaik2001/b691035babea7d5cff6e4f5c66dbc580 to your computer and use it in GitHub Desktop.
val PROGRESS_MAX = 100
val PROGRESS_CURRENT = 0
val notificationManagerCompat = NotificationManagerCompat.from(context)
builder.setProgress(PROGRESS_MAX, PROGRESS_CURRENT, false)
notificationManagerCompat.notify(1234, builder.build())
CoroutineScope(Dispatchers.Default).launch {
for (i in PROGRESS_CURRENT..PROGRESS_MAX step 10) {
builder.setProgress(PROGRESS_MAX, i, false)
notificationManagerCompat.notify(1234, builder.build());
delay(1000)
}
delay(10000)
builder.setContentText("Download complete")
.setProgress(0, 0, false)
notificationManagerCompat.notify(1234, builder.build())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment