In part 6 of the notifications tutorial, we will learn how to add a ProgressBar to a notification and update it periodically. This is useful if you for example want to download something in a Foreground Service.
To add the ProgressBar, we call setProgress on our NotificationCompat.Builder, where we have to pas a max value, the progress value and a boolean which indicates if we want to have an indeterminate ProgressBar that has an ongoing animation, or a determinate ProgressBar that shows the actual progress.
With setOngoing we can make our notification persistent, so it can’t be swiped away, and with setOnlyAlertOnce we make sure that it doesn’t make sound or pop up everytime we update it with notificationManager.notify.
Watch the whole playlist:
❗ Subscribe to the channel:
⏯ Watch more tutorials:
⭐ Become a channel member for exclusive tutorials and other perks:
㊙ Help translating the videos:
💚 Support the content:
💬 Join the Discord chat:
🎧 Audiobooks and podcasts for programmers:
👶 How to get started with Android development:
📣 Follow Coding in Flow on social media: