# DownloadNotificationHelper

# DownloadNotificationHelper

Artifact:[androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3)  
[View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/offline/DownloadNotificationHelper.java+class:androidx.media3.exoplayer.offline.DownloadNotificationHelper)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/exoplayer/offline/DownloadNotificationHelper "View this page in Java")

<br />

```
@UnstableApi
class DownloadNotificationHelper
```

<br />

*** ** * ** ***

Helper for creating download notifications.

## Summary

|                                                                                                                                                                                            ### Public constructors                                                                                                                                                                                             |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [DownloadNotificationHelper](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadNotificationHelper#DownloadNotificationHelper(android.content.Context,java.lang.String))`(context: `[Context](https://developer.android.com/reference/android/content/Context.html)`!, channelId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` |

|                                   ### Public functions                                   |
|------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Notification](https://developer.android.com/reference/android/app/Notification.html)`!` | [buildDownloadCompletedNotification](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadNotificationHelper#buildDownloadCompletedNotification(android.content.Context,int,android.app.PendingIntent,java.lang.String))`(` ` context: `[Context](https://developer.android.com/reference/android/content/Context.html)`!,` ` smallIcon: @`[DrawableRes](https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` contentIntent: `[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)`?,` ` message: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` `)` Returns a notification for a completed download.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [Notification](https://developer.android.com/reference/android/app/Notification.html)`!` | [buildDownloadFailedNotification](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadNotificationHelper#buildDownloadFailedNotification(android.content.Context,int,android.app.PendingIntent,java.lang.String))`(` ` context: `[Context](https://developer.android.com/reference/android/content/Context.html)`!,` ` smallIcon: @`[DrawableRes](https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` contentIntent: `[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)`?,` ` message: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` `)` Returns a notification for a failed download.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| [Notification](https://developer.android.com/reference/android/app/Notification.html)`!` | [buildProgressNotification](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/DownloadNotificationHelper#buildProgressNotification(android.content.Context,int,android.app.PendingIntent,java.lang.String,java.util.List<androidx.media3.exoplayer.offline.Download>,int))`(` ` context: `[Context](https://developer.android.com/reference/android/content/Context.html)`!,` ` smallIcon: @`[DrawableRes](https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`,` ` contentIntent: `[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)`?,` ` message: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?,` ` downloads: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Download](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/Download)`!>!,` ` @`[Requirements.RequirementFlags](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/scheduler/Requirements.RequirementFlags)` notMetRequirements: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` Returns a progress notification for the given downloads. |

## Public constructors

### DownloadNotificationHelper

```
DownloadNotificationHelper(context: Context!, channelId: String!)
```  

|                                            Parameters                                             |
|---------------------------------------------------------------------------------------------------|--------------------------------------------|
| `context: `[Context](https://developer.android.com/reference/android/content/Context.html)`!`     | A context.                                 |
| `channelId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | The id of the notification channel to use. |

## Public functions

### buildDownloadCompletedNotification

```
fun buildDownloadCompletedNotification(
    context: Context!,
    smallIcon: @DrawableRes Int,
    contentIntent: PendingIntent?,
    message: String?
): Notification!
```

Returns a notification for a completed download.  

|                                                                                        Parameters                                                                                         |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| `context: `[Context](https://developer.android.com/reference/android/content/Context.html)`!`                                                                                             | A context.                                                           |
| `smallIcon: @`[DrawableRes](https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | A small icon for the notifications.                                  |
| `contentIntent: `[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)`?`                                                                               | An optional content intent to send when the notification is clicked. |
| `message: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?`                                                                                           | An optional message to display on the notification.                  |

|                                         Returns                                          |
|------------------------------------------------------------------------------------------|-------------------|
| [Notification](https://developer.android.com/reference/android/app/Notification.html)`!` | The notification. |

### buildDownloadFailedNotification

```
fun buildDownloadFailedNotification(
    context: Context!,
    smallIcon: @DrawableRes Int,
    contentIntent: PendingIntent?,
    message: String?
): Notification!
```

Returns a notification for a failed download.  

|                                                                                        Parameters                                                                                         |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| `context: `[Context](https://developer.android.com/reference/android/content/Context.html)`!`                                                                                             | A context.                                                           |
| `smallIcon: @`[DrawableRes](https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | A small icon for the notifications.                                  |
| `contentIntent: `[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)`?`                                                                               | An optional content intent to send when the notification is clicked. |
| `message: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?`                                                                                           | An optional message to display on the notification.                  |

|                                         Returns                                          |
|------------------------------------------------------------------------------------------|-------------------|
| [Notification](https://developer.android.com/reference/android/app/Notification.html)`!` | The notification. |

### buildProgressNotification

```
fun buildProgressNotification(
    context: Context!,
    smallIcon: @DrawableRes Int,
    contentIntent: PendingIntent?,
    message: String?,
    downloads: (Mutable)List<Download!>!,
    @Requirements.RequirementFlags notMetRequirements: Int
): Notification!
```

Returns a progress notification for the given downloads.  

|                                                                                                                                                         Parameters                                                                                                                                                          |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| `context: `[Context](https://developer.android.com/reference/android/content/Context.html)`!`                                                                                                                                                                                                                               | A context.                                                           |
| `smallIcon: @`[DrawableRes](https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                   | A small icon for the notification.                                   |
| `contentIntent: `[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent.html)`?`                                                                                                                                                                                                                 | An optional content intent to send when the notification is clicked. |
| `message: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?`                                                                                                                                                                                                                             | An optional message to display on the notification.                  |
| `downloads: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Download](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/offline/Download)`!>!` | The downloads.                                                       |
| `@`[Requirements.RequirementFlags](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/scheduler/Requirements.RequirementFlags)` notMetRequirements: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                      | Any requirements for downloads that are not currently met.           |

|                                         Returns                                          |
|------------------------------------------------------------------------------------------|-------------------|
| [Notification](https://developer.android.com/reference/android/app/Notification.html)`!` | The notification. |