O Google tem o compromisso de promover a igualdade racial para as comunidades negras. Saiba como.

NotificationChannelCompat

public class NotificationChannelCompat
extends Object

java.lang.Object
   ↳ androidx.core.app.NotificationChannelCompat


A representation of settings that apply to a collection of similarly themed notifications. Setters return this to allow chaining. This class doesn't do anything on older SDKs which don't support Notification Channels.

Summary

Nested classes

class NotificationChannelCompat.Builder

Builder class for NotificationChannelCompat objects. 

Constants

String DEFAULT_CHANNEL_ID

The id of the default channel for an app.

Public methods

boolean canBubble()

Returns whether notifications posted to this channel are allowed to display outside of the notification shade, in a floating window on top of other apps.

boolean canBypassDnd()

Whether or not notifications posted to this channel can bypass the Do Not Disturb NotificationManager.INTERRUPTION_FILTER_PRIORITY mode.

boolean canShowBadge()

Returns whether notifications posted to this channel can appear as badges in a Launcher application.

AudioAttributes getAudioAttributes()

Returns the audio attributes for sound played by notifications posted to this channel.

String getConversationId()

Returns the id of the conversation backing this channel, if it's associated with a conversation.

String getDescription()

Returns the user visible description of this channel.

String getGroup()

Returns what group this channel belongs to.

String getId()

Returns the id of this channel.

int getImportance()

Returns the user specified importance e.g.

int getLightColor()

Returns the notification light color for notifications posted to this channel.

int getLockscreenVisibility()

Returns whether or not notifications posted to this channel are shown on the lockscreen in full or redacted form.

CharSequence getName()

Returns the user visible name of this channel.

String getParentChannelId()

Returns the id of the parent notification channel to this channel, if it's a conversation related channel.

Uri getSound()

Returns the notification sound for this channel.

long[] getVibrationPattern()

Returns the vibration pattern for notifications posted to this channel.

boolean isImportantConversation()

Whether or not notifications in this conversation are considered important.

boolean shouldShowLights()

Returns whether notifications posted to this channel trigger notification lights.

boolean shouldVibrate()

Returns whether notifications posted to this channel always vibrate.

NotificationChannelCompat.Builder toBuilder()

Creates a NotificationChannelCompat.Builder instance with all the writeable property values of this instance.

Inherited methods

Constants

DEFAULT_CHANNEL_ID

public static final String DEFAULT_CHANNEL_ID

The id of the default channel for an app. This id is reserved by the system. All notifications posted from apps targeting Build.VERSION_CODES.N_MR1 or earlier without a notification channel specified are posted to this channel.

Constant Value: "miscellaneous"

Public methods

canBubble

public boolean canBubble ()

Returns whether notifications posted to this channel are allowed to display outside of the notification shade, in a floating window on top of other apps.

This is a read-only property which is only valid on instances fetched from the NotificationManagerCompat.

Returns
boolean

canBypassDnd

public boolean canBypassDnd ()

Whether or not notifications posted to this channel can bypass the Do Not Disturb NotificationManager.INTERRUPTION_FILTER_PRIORITY mode.

This is a read-only property which is only valid on instances fetched from the NotificationManagerCompat.

Returns
boolean

canShowBadge

public boolean canShowBadge ()

Returns whether notifications posted to this channel can appear as badges in a Launcher application. Note that badging may be disabled for other reasons.

Returns
boolean

getAudioAttributes

public AudioAttributes getAudioAttributes ()

Returns the audio attributes for sound played by notifications posted to this channel.

Returns
AudioAttributes

getConversationId

public String getConversationId ()

Returns the id of the conversation backing this channel, if it's associated with a conversation. See NotificationChannelCompat.Builder.setConversationId(String, String).

Returns
String

getDescription

public String getDescription ()

Returns the user visible description of this channel.

Returns
String

getGroup

public String getGroup ()

Returns what group this channel belongs to. This is used only for visually grouping channels in the UI.

Returns
String

getId

public String getId ()

Returns the id of this channel.

Returns
String

getImportance

public int getImportance ()

Returns the user specified importance e.g. NotificationManagerCompat.IMPORTANCE_LOW for notifications posted to this channel. Note: This value might be > NotificationManagerCompat.IMPORTANCE_NONE, but notifications posted to this channel will not be shown to the user if the parent NotificationChannelGroup or app is blocked. See NotificationChannelGroup.isBlocked() and NotificationManagerCompat.areNotificationsEnabled().

Returns
int

getLightColor

public int getLightColor ()

Returns the notification light color for notifications posted to this channel. Irrelevant unless shouldShowLights().

Returns
int

getLockscreenVisibility

public int getLockscreenVisibility ()

Returns whether or not notifications posted to this channel are shown on the lockscreen in full or redacted form.

This is a read-only property which is only valid on instances fetched from the NotificationManagerCompat.

Returns
int

getName

public CharSequence getName ()

Returns the user visible name of this channel.

Returns
CharSequence

getParentChannelId

public String getParentChannelId ()

Returns the id of the parent notification channel to this channel, if it's a conversation related channel. See NotificationChannelCompat.Builder.setConversationId(String, String).

Returns
String

getSound

public Uri getSound ()

Returns the notification sound for this channel.

Returns
Uri

getVibrationPattern

public long[] getVibrationPattern ()

Returns the vibration pattern for notifications posted to this channel. Will be ignored if vibration is not enabled (shouldVibrate().

Returns
long[]

isImportantConversation

public boolean isImportantConversation ()

Whether or not notifications in this conversation are considered important.

Important conversations may get special visual treatment, and might be able to bypass DND.

This is only valid for channels that represent conversations, that is, those with a valid conversation id.

This is a read-only property which is only valid on instances fetched from the NotificationManagerCompat.

Returns
boolean

shouldShowLights

public boolean shouldShowLights ()

Returns whether notifications posted to this channel trigger notification lights.

Returns
boolean

shouldVibrate

public boolean shouldVibrate ()

Returns whether notifications posted to this channel always vibrate.

Returns
boolean

toBuilder

public NotificationChannelCompat.Builder toBuilder ()

Creates a NotificationChannelCompat.Builder instance with all the writeable property values of this instance.

Returns
NotificationChannelCompat.Builder