Example usage for android.app NotificationChannelGroup getId

List of usage examples for android.app NotificationChannelGroup getId

Introduction

In this page you can find the example usage for android.app NotificationChannelGroup getId.

Prototype

public String getId() 

Source Link

Document

Returns the id of this group.

Usage

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) {
            }//w  w w.j  av  a 2  s.  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) {
            }
        }
    }
}