@ Implementation ( minSdk = Build . VERSION_CODES . O ) protected void deleteNotificationChannelGroup ( String channelGroupId ) { if ( getNotificationChannelGroup ( channelGroupId ) != null ) { // Deleting a channel group also deleted all associated channels. See // https://developer.android.com/reference/android/app/NotificationManager.html#deleteNotificationChannelGroup%28java.lang.String%29 // for more info. for ( /* NotificationChannel */ Object channel : getNotificationChannels ( ) ) { String groupId = ReflectionHelpers . callInstanceMethod ( channel , "getGroup" ) ; if ( channelGroupId . equals ( groupId ) ) { String channelId = ReflectionHelpers . callInstanceMethod ( channel , "getId" ) ; deleteNotificationChannel ( channelId ) ; } } notificationChannelGroups . remove ( channelGroupId ) ; } }
Delete a notification channel group and all notification channels associated with the group . This method will not notify any NotificationListenerService of resulting changes to notification channel groups nor to notification channels .