Notifications Tutorial Part 1 – NOTIFICATION CHANNELS – Android Studio Tutorial
In this video series we will learn everything about notifications in Android.
In part 1 we will start by creating notification channels (Categories) which are necessary since Android Oreo (API level 26) to be able to show any notifications. These channels should be created as soon as we start our app, so we will do it in the onCreate method of a class that extends Application.
When we create these channels, we have to pass an ID, a name and an importance level. Additionally we can customize the channel further, like enabling the LED, activating vibration or changing the sound, but the user has ultimate control over the channel’s behavior.
When our NotificationChannel objects are created, we pass them to the NotificationManager’s createNotificationChannel method.
When we then want to show a notification, we create it with the NotificationCompat.Builder, where we can set a title, a message, an icon, a priority level, a category and many more customization options, and then we pass this
Notification object to the NotificationManagerCompat’s notify method, where we also have to pass an ID which we can later use to update or cancel this particular notification.
Documentation:
NotificationManager:
https://developer.android.com/reference/android/app/NotificationManager
NotificationChannel:
https://developer.android.com/reference/android/app/NotificationChannel
NotificationCompat:
https://developer.android.com/reference/android/support/v4/app/NotificationCompat
NotificationCompat.Builder:
https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder
Watch the whole playlist:
Example code for this part:
https://gist.github.com/codinginflow/33e2ef8270892acca1ce7cab955ee3d3
____________________
💻 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 :243912
android studio