I've created a few notification channels on my android app using:
val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
notificationManager.createNotificationChannel(mChannel)
My question now is if it's possible to manage (enable/disable) notifications (and channels) inside the app or if we should always redirect the user to the android settings to manage that?
Examples: Can I completely disable notifications programatically? Can I do that only for a specific channel?
You cannot edit a NotificationChannel once it created. It will keep the original configuration, even if you delete the channel and re-create it again (with the same channel id).
In the Settings app, it turns off a specific notification channel by using INotificationManager.updateNotificationChannelGroupForPackage
, which is a hidden API.
Therefore, the only way to manage notifications is always to redirect users to the Settings page.