Example usage for android.app NotificationManager deleteNotificationChannelGroup

List of usage examples for android.app NotificationManager deleteNotificationChannelGroup

Introduction

In this page you can find the example usage for android.app NotificationManager deleteNotificationChannelGroup.

Prototype

public void deleteNotificationChannelGroup(String groupId) 

Source Link

Document

Deletes the given notification channel group, and all notification channels that belong to it.

Usage

From source file:com.ruesga.rview.misc.NotificationsHelper.java

@TargetApi(Build.VERSION_CODES.O)
public static void deleteNotificationChannel(Context context, Account account) {
    if (AndroidHelper.isApi26OrGreater()) {
        final NotificationManager nm = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);
        nm.deleteNotificationChannelGroup(account.getAccountHash());
    }/* ww  w. j  a va2  s.  c  o  m*/
}

From source file:com.keylesspalace.tusky.util.NotificationHelper.java

public static void deleteNotificationChannelsForAccount(@NonNull AccountEntity account,
        @NonNull Context context) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

        NotificationManager notificationManager = (NotificationManager) context
                .getSystemService(Context.NOTIFICATION_SERVICE);

        //noinspection ConstantConditions
        notificationManager.deleteNotificationChannelGroup(account.getIdentifier());

    }/*from w w  w. ja v  a 2  s.c o  m*/
}

From source file:com.irccloud.android.data.collection.NotificationsList.java

public void pruneNotificationChannels() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        NotificationManager nm = ((NotificationManager) IRCCloudApplication.getInstance()
                .getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE));

        for (NotificationChannelGroup c : nm.getNotificationChannelGroups()) {
            try {
                if (ServersList.getInstance().getServer(Integer.valueOf(c.getId())) == null)
                    nm.deleteNotificationChannelGroup(c.getId());
            } catch (NumberFormatException e) {
            }//from   ww w .j ava  2s  .c  o  m
        }

        for (NotificationChannel c : nm.getNotificationChannels()) {
            try {
                if (BuffersList.getInstance().getBuffer(Integer.valueOf(c.getId())) == null)
                    nm.deleteNotificationChannel(c.getId());
            } catch (NumberFormatException e) {
            }
        }
    }
}