# NotificationCompat.TvExtender

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

*** ** * ** ***


```
public final class NotificationCompat.TvExtender implements NotificationCompat.Extender
```

<br />

*** ** * ** ***

Helper class to add Android TV extensions to notifications.

To create a notification with a TV extension:

1. Create an `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder`, setting any desired properties.
2. Create a `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender`.
3. Set TV-specific properties using the `set` methods of `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender`.
4. Call `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#extend(androidx.core.app.NotificationCompat.Extender)` to apply the extension to a notification.

```
Notification notification = new NotificationCompat.Builder(context)
        ...
        .extend(new TvExtender()
                .setChannelId("channel id"))
        .build();
NotificationManagerCompat.from(mContext).notify(0, notification);
```

TV extensions can be accessed on an existing notification by using the `TvExtender(Notification)` constructor, and then using the `get` methods to access values.

Note that prior to `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#O` this field has no effect.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender#TvExtender()()` Create a `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender` with default options. |
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender#TvExtender(android.app.Notification)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Notification.html notif)` Create a `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender` from the TvExtender options of an existing Notification. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender#extend(androidx.core.app.NotificationCompat.Builder)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder builder)` Apply a TV extension to a notification that is being built. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender#getChannelId()()` Returns the id of the channel this notification posts to on TV. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/PendingIntent.html` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender#getContentIntent()()` Returns the TV-specific content intent. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/PendingIntent.html` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender#getDeleteIntent()()` Returns the TV-specific delete intent. |
| `boolean` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender#isAvailableOnTv()()` Returns true if this notification should be shown on TV. |
| `boolean` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender#isSuppressShowOverApps()()` Returns true if this notification should not show messages over top of apps outside of the launcher. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender#setChannelId(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html channelId)` Specifies the channel the notification should be delivered on when shown on TV. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender#setContentIntent(android.app.PendingIntent)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/PendingIntent.html intent)` Supplies a `https://developer.android.com/reference/android/app/PendingIntent.html` to be sent when the notification is selected on TV. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender#setDeleteIntent(android.app.PendingIntent)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/PendingIntent.html intent)` Supplies a `https://developer.android.com/reference/android/app/PendingIntent.html` to send when the notification is cleared explicitly by the user on TV. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender#setSuppressShowOverApps(boolean)(boolean suppress)` Specifies whether this notification should suppress showing a message over top of apps outside of the launcher. |

## Public constructors

### TvExtender

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

```
public TvExtender()
```

Create a `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender` with default options.

### TvExtender

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

```
public TvExtender(@NonNull Notification notif)
```

Create a `https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender` from the TvExtender options of an existing Notification.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Notification.html notif` | The notification from which to copy options. |

## Public methods

### extend

```
public @NonNull NotificationCompat.Builder extend(@NonNull NotificationCompat.Builder builder)
```

Apply a TV extension to a notification that is being built. This is typically called by the `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#extend(androidx.core.app.NotificationCompat.Extender)` method of `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder`.

### getChannelId

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

```
public @Nullable String getChannelId()
```

Returns the id of the channel this notification posts to on TV.

### getContentIntent

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

```
public @Nullable PendingIntent getContentIntent()
```

Returns the TV-specific content intent. If this method returns null, the main content intent on the notification should be used.

| See also |
|---|---|
| `https://developer.android.com/reference/android/app/Notification.html#contentIntent` | `https://developer.android.com/reference/android/app/Notification.html#contentIntent` |

### getDeleteIntent

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

```
public @Nullable PendingIntent getDeleteIntent()
```

Returns the TV-specific delete intent. If this method returns null, the main delete intent on the notification should be used.

| See also |
|---|---|
| `https://developer.android.com/reference/android/app/Notification.html#deleteIntent` | `https://developer.android.com/reference/android/app/Notification.html#deleteIntent` |

### isAvailableOnTv

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

```
public boolean isAvailableOnTv()
```

Returns true if this notification should be shown on TV. This method return true if the notification was extended with a TvExtender.

### isSuppressShowOverApps

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

```
public boolean isSuppressShowOverApps()
```

Returns true if this notification should not show messages over top of apps outside of the launcher.

### setChannelId

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

```
public @NonNull NotificationCompat.TvExtender setChannelId(@Nullable String channelId)
```

Specifies the channel the notification should be delivered on when shown on TV. It can be different from the channel that the notification is delivered to when posting on a non-TV device.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html channelId` | The channelId to use in the tv notification. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.TvExtender` | The object for method chaining. |

### setContentIntent

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

```
public @NonNull NotificationCompat.TvExtender setContentIntent(@Nullable PendingIntent intent)
```

Supplies a `https://developer.android.com/reference/android/app/PendingIntent.html` to be sent when the notification is selected on TV. If provided, it is used instead of the content intent specified at the level of Notification.

### setDeleteIntent

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

```
public @NonNull NotificationCompat.TvExtender setDeleteIntent(@Nullable PendingIntent intent)
```

Supplies a `https://developer.android.com/reference/android/app/PendingIntent.html` to send when the notification is cleared explicitly by the user on TV. If provided, it is used instead of the delete intent specified at the level of Notification.

### setSuppressShowOverApps

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

```
public @NonNull NotificationCompat.TvExtender setSuppressShowOverApps(boolean suppress)
```

Specifies whether this notification should suppress showing a message over top of apps outside of the launcher.