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 for this part:
https://gist.github.com/codinginflow/50019212ca70179c82e203442a7a9ed5
____________________
💻 Find the BEST programming tutorials on TutHub:
https://tuthub.io
⭐ Get my MVVM Caching Course now:
https://codinginflow.com/caching
❗ Subscribe to the channel:
https://www.youtube.com/c/codinginflo…
📨 Subscribe to the Coding in Flow newsletter:
https://codinginflow.com/newsletter
❓ Join our free developer community:
https://discord.gg/TSnMvmc
📣 Follow Coding in Flow on other sites:
Facebook: https://www.facebook.com/codinginflow
Instagram: https://www.instagram.com/codinginflow
TikTok: https://www.tiktok.com/@codinginflow
Twitter: https://twitter.com/codinginflow
Github: https://github.com/codinginflow
💰 Business requests, sponsoring, etc.: info@codinginflow.com
Views :29945
android studio