Notifications Tutorial Part 6 – PROGRESS BAR NOTIFICATION – Android Studio Tutorial

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:

Example code:

❗ 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:





21 Replies to “Notifications Tutorial Part 6 – PROGRESS BAR NOTIFICATION – Android Studio Tutorial”

  1. Natasha TSAI

    Hello, is this the progressBar you mentioned?( I'm the one asked progressbar notification in PART 1)
    What if I already have a progressBar on my APP, and I just want to put it on the notification place?
    Thank you so much

  2. Andrei Trifan

    First of all congrats and thank you for the great work! Your tutorials are very informative and concise. I am currently having an issue setting the completion progress to (0, 0, false) when more parallel downloads are being finished. Some notifications just remain at a previous progress and do not get updated to the final status. Also important is to note that each notification does not get updates more often than once every second, so there is no possibility of them being updated too often and the system to just drop a few updates, as specified in the Google Docs. The only thing that worked so far was setting the progress to (100, 100, false). This way all 10 parallel downloads have been correctly updated, but it's just not nice keeping the progress bar in a finished notification. Setting progress to (0, 0, false) is just not always working, do you have any idea which details I could have missed? I am using the exact same builder calls to create the notifications as you did. Thanks in advance!

  3. Fabrizio Almeida

    Hey man, how are you? i hope is fine, man i found a little issues on some devices when i uses services and broadcasts, searching on the internet i found some articles, and this articles says, some custom rooms like Xiamo redmi not 5 "my phone" this rooms is customized for kill all background service when user kill app, so i dont receive any push when i kill app, i test many times and all the time i kill the app no push message came. this is a wrong because porpuse off a push notifications is received messages when app is dead or not? can you help me if you know somthing about?

  4. 4YT only

    Hey man, me again 🙂 Your vids are like a bible to me, I can't explain how much it meant to me to find this channel, your methods are amazing and I really learned a lot from them. So… I already asked once (and you replyed 🙂 but now I must ask again. Video about generating signed apks, creating split apks (all versions like you always do) and finally uploading them to play store. Setting different languages for display at play store, uploading one apk or all split versions 🙂 And also uploading new updated versions of app and if you can, uploading and working with expansion files. Thx and keep up the great work!!!

Leave a Reply

Your email address will not be published. Required fields are marked *