# NotificationCompat.ProjectedExtender

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.ProjectedExtender) Added in [1.18.0](https://developer.android.com/jetpack/androidx/releases/core#1.18.0)

*** ** * ** ***


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

<br />

*** ** * ** ***

Helper class to add projection-specific extensions to a notification. This class is used to specify metadata that is specific to notifications that may be displayed on a Projected device.

To create a notification with Projected extensions:

1. Create a `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder` for the notification.
2. Create an `ProjectedExtender`.
3. Set projection-specific properties using the `set` methods on the `ProjectedExtender`.
4. Call `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#extend(androidx.core.app.NotificationCompat.Extender)` to apply the extensions to the notification.

```
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID)
    .setContentTitle("Example Title")
    .setContentText("Example Text")
    .setSmallIcon(R.drawable.ic_notification);

ProjectedExtender projectedExtender = new ProjectedExtender()
    .setContentIntent(projectedTapIntent);

builder.extend(projectedExtender);
notificationManager.notify(NOTIFICATION_ID, builder.build());
```

## Summary

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

| ### 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.ProjectedExtender#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)` Applies the Project extensions to the notification builder. |
| `@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.ProjectedExtender#getContentIntent()()` Returns the `https://developer.android.com/reference/android/app/PendingIntent.html` to be fired when the notification is tapped on the Projected device. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProjectedExtender` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProjectedExtender#setContentIntent(android.app.PendingIntent)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/PendingIntent.html intent)` Sets the `https://developer.android.com/reference/android/app/PendingIntent.html` to be opened on the Projected device when the notification is tapped on the that device. |

## Public constructors

### ProjectedExtender

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

```
public ProjectedExtender()
```

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

### ProjectedExtender

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

```
public ProjectedExtender(@NonNull Notification notification)
```

Creates an `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProjectedExtender` from the extensions in a `https://developer.android.com/reference/android/app/Notification.html`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Notification.html notification` | the notification to extract extensions from. |

## Public methods

### extend

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

Applies the Project extensions to the notification builder. This method is called by the `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#extend(androidx.core.app.NotificationCompat.Extender)` method and should not be called directly.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder builder` | the notification builder to extend |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder` | the modified notification builder |

### getContentIntent

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

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

Returns the `https://developer.android.com/reference/android/app/PendingIntent.html` to be fired when the notification is tapped on the Projected device.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/PendingIntent.html` | the `https://developer.android.com/reference/android/app/PendingIntent.html` to fire on tap, or null if not set |

### setContentIntent

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

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

Sets the `https://developer.android.com/reference/android/app/PendingIntent.html` to be opened on the Projected device when the notification is tapped on the that device. This is distinct from the notification's main `https://developer.android.com/reference/android/app/Notification.html#contentIntent`, which is typically fired when the notification is tapped on the host device (e.g., the phone).

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/PendingIntent.html intent` | the `https://developer.android.com/reference/android/app/PendingIntent.html` to fire on tap |

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