# NotificationChannelCompat

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/app/NotificationChannelCompat.java+class:androidx.core.app.NotificationChannelCompat) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

*** ** * ** ***

<br />

```
class NotificationChannelCompat
```

<br />

*** ** * ** ***

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 types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat.Builder` Builder class for `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat` objects. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#DEFAULT_CHANNEL_ID() = "miscellaneous"` The id of the default channel for an app. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#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. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#canBypassDnd()()` Whether or not notifications posted to this channel can bypass the Do Not Disturb `https://developer.android.com/reference/android/app/NotificationManager.html#INTERRUPTION_FILTER_PRIORITY` mode. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#canShowBadge()()` Returns whether notifications posted to this channel can appear as badges in a Launcher application. |
| `https://developer.android.com/reference/android/media/AudioAttributes.html?` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#getAudioAttributes()()` Returns the audio attributes for sound played by notifications posted to this channel. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#getConversationId()()` Returns the `https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat#getId()` of the conversation backing this channel, if it's associated with a conversation. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#getDescription()()` Returns the user visible description of this channel. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#getGroup()()` Returns what group this channel belongs to. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#getId()()` Returns the id of this channel. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#getImportance()()` Returns the user specified importance e.g. `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationManagerCompat#IMPORTANCE_LOW()` for notifications posted to this channel. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#getLightColor()()` Returns the notification light color for notifications posted to this channel. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#getLockscreenVisibility()()` Returns whether or not notifications posted to this channel are shown on the lockscreen in full or redacted form. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html?` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#getName()()` Returns the user visible name of this channel. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#getParentChannelId()()` Returns the `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#getId()` of the parent notification channel to this channel, if it's a conversation related channel. |
| `https://developer.android.com/reference/android/net/Uri.html?` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#getSound()()` Returns the notification sound for this channel. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>?` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#getVibrationPattern()()` Returns the vibration pattern for notifications posted to this channel. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#isImportantConversation()()` Whether or not notifications in this conversation are considered important. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#shouldShowLights()()` Returns whether notifications posted to this channel trigger notification lights. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#shouldVibrate()()` Returns whether notifications posted to this channel always vibrate. |
| `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat.Builder` | `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#toBuilder()()` Creates a `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat.Builder` instance with all the writeable property values of this instance. |

## Constants

### DEFAULT_CHANNEL_ID

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
const val DEFAULT_CHANNEL_ID = "miscellaneous": String!
```

The id of the default channel for an app. This id is reserved by the system. All notifications posted from apps targeting `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#N_MR1` or earlier without a notification channel specified are posted to this channel.

## Public functions

### canBubble

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun canBubble(): Boolean
```

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 `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationManagerCompat`.

### canBypassDnd

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun canBypassDnd(): Boolean
```

Whether or not notifications posted to this channel can bypass the Do Not Disturb `https://developer.android.com/reference/android/app/NotificationManager.html#INTERRUPTION_FILTER_PRIORITY` mode.

This is a read-only property which is only valid on instances fetched from the `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationManagerCompat`.

### canShowBadge

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun canShowBadge(): Boolean
```

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

### getAudioAttributes

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun getAudioAttributes(): AudioAttributes?
```

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

### getConversationId

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun getConversationId(): String?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/core/content/pm/ShortcutInfoCompat#getId()` of the conversation backing this channel, if it's associated with a conversation. See `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat.Builder#setConversationId(java.lang.String,java.lang.String)`.

### getDescription

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun getDescription(): String?
```

Returns the user visible description of this channel.

### getGroup

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun getGroup(): String?
```

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

### getId

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun getId(): String
```

Returns the id of this channel.

### getImportance

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun getImportance(): Int
```

Returns the user specified importance e.g. `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationManagerCompat#IMPORTANCE_LOW()` for notifications posted to this channel. Note: This value might be \>`https://developer.android.com/reference/kotlin/androidx/core/app/NotificationManagerCompat#IMPORTANCE_NONE()`, but notifications posted to this channel will not be shown to the user if the parent `https://developer.android.com/reference/android/app/NotificationChannelGroup.html` or app is blocked. See `https://developer.android.com/reference/android/app/NotificationChannelGroup.html#isBlocked()` and `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationManagerCompat#areNotificationsEnabled()`.

### getLightColor

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun getLightColor(): Int
```

Returns the notification light color for notifications posted to this channel. Irrelevant unless `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#shouldShowLights()`.

### getLockscreenVisibility

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun getLockscreenVisibility(): Int
```

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 `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationManagerCompat`.

### getName

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun getName(): CharSequence?
```

Returns the user visible name of this channel.

### getParentChannelId

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun getParentChannelId(): String?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#getId()` of the parent notification channel to this channel, if it's a conversation related channel. See `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat.Builder#setConversationId(java.lang.String,java.lang.String)`.

### getSound

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun getSound(): Uri?
```

Returns the notification sound for this channel.

### getVibrationPattern

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun getVibrationPattern(): Array<Long>?
```

Returns the vibration pattern for notifications posted to this channel. Will be ignored if vibration is not enabled (`https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#shouldVibrate()`.

### isImportantConversation

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun isImportantConversation(): Boolean
```

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 `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat#getConversationId()`.

This is a read-only property which is only valid on instances fetched from the `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationManagerCompat`.

### shouldShowLights

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun shouldShowLights(): Boolean
```

Returns whether notifications posted to this channel trigger notification lights.

### shouldVibrate

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun shouldVibrate(): Boolean
```

Returns whether notifications posted to this channel always vibrate.

### toBuilder

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
fun toBuilder(): NotificationChannelCompat.Builder
```

Creates a `https://developer.android.com/reference/kotlin/androidx/core/app/NotificationChannelCompat.Builder` instance with all the writeable property values of this instance.