# ZenPolicy.Builder

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/service/notification/ZenPolicy.Builder "View this page in Java")  

```
class Builder
```

|---|--------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                   ||
| ↳ | [android.service.notification.ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) |

Builder class for[ZenPolicy](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy)objects. Provides a convenient way to set the various fields of a[ZenPolicy](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy). If a field is not set, it is (@link STATE_UNSET} and will not change the current set policy.

## Summary

|                                                       Public constructors                                                        ||
|-------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#Builder())`()` <br /> |

|                                                                                                                                                                                                                                                                                                                                                       Public methods                                                                                                                                                                                                                                                                                                                                                        ||
|---------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [allowAlarms](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#allowAlarms(kotlin.Boolean))`(`allow:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Whether to allow notifications with category[Notification.CATEGORY_ALARM](https://developer.android.com/reference/kotlin/android/app/Notification.html#CATEGORY_ALARM:kotlin.String)to play sounds and visually appear or to intercept them when DND is active.                                                                                              |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [allowAllSounds](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#allowAllSounds())`()` Allows all notifications to bypass DND and unmutes all streams.                                                                                                                                                                                                                                                                                                                                                                                                   |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [allowCalls](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#allowCalls(kotlin.Int))`(`audienceType:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Whether to allow notifications with category[Notification.CATEGORY_CALL](https://developer.android.com/reference/kotlin/android/app/Notification.html#CATEGORY_CALL:kotlin.String)that match audienceType to play sounds and visually appear or to intercept them when DND is active.                                                                               |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [allowConversations](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#allowConversations(kotlin.Int))`(`audienceType:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Whether to allow conversation notifications (see[NotificationChannel.setConversationId(String, String)](https://developer.android.com/reference/kotlin/android/app/NotificationChannel.html#setConversationId(kotlin.String,%20kotlin.String))) that match audienceType to play sounds and visually appear or to intercept them when DND is active. |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [allowEvents](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#allowEvents(kotlin.Boolean))`(`allow:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Whether to allow notifications with category[Notification.CATEGORY_EVENT](https://developer.android.com/reference/kotlin/android/app/Notification.html#CATEGORY_EVENT:kotlin.String)to play sounds and visually appear or to intercept them when DND is active.                                                                                              |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [allowMedia](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#allowMedia(kotlin.Boolean))`(`allow:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Whether to allow media notifications to play sounds and visually appear or to intercept them when DND is active.                                                                                                                                                                                                                                               |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [allowMessages](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#allowMessages(kotlin.Int))`(`audienceType:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Whether to allow notifications with category[Notification.CATEGORY_MESSAGE](https://developer.android.com/reference/kotlin/android/app/Notification.html#CATEGORY_MESSAGE:kotlin.String)that match audienceType to play sounds and visually appear or to intercept them when DND is active.                                                                   |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [allowPriorityChannels](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#allowPriorityChannels(kotlin.Boolean))`(`allow:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Set whether priority channels are permitted to break through DND.                                                                                                                                                                                                                                                                        |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [allowReminders](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#allowReminders(kotlin.Boolean))`(`allow:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Whether to allow notifications with category[Notification.CATEGORY_REMINDER](https://developer.android.com/reference/kotlin/android/app/Notification.html#CATEGORY_REMINDER:kotlin.String)to play sounds and visually appear or to intercept them when DND is active.                                                                                  |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [allowRepeatCallers](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#allowRepeatCallers(kotlin.Boolean))`(`allow:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Whether to allow repeat callers (notifications with category[Notification.CATEGORY_CALL](https://developer.android.com/reference/kotlin/android/app/Notification.html#CATEGORY_CALL:kotlin.String)that have recently called to play sounds and visually appear.                                                                                |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [allowSystem](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#allowSystem(kotlin.Boolean))`(`allow:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Whether to allow system sounds to play when DND is active.                                                                                                                                                                                                                                                                                                   |
| [ZenPolicy](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy)                  | [build](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#build())`()` Builds the current ZenPolicy.                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [disallowAllSounds](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#disallowAllSounds())`()` Intercepts all notifications and prevents them from playing sounds when DND is active.                                                                                                                                                                                                                                                                                                                                                                      |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [hideAllVisualEffects](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#hideAllVisualEffects())`()` Disallows notifications intercepted by DND from showing when DND is active.                                                                                                                                                                                                                                                                                                                                                                           |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [showAllVisualEffects](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#showAllVisualEffects())`()` Allows notifications intercepted by DND to show on all surfaces when DND is active.                                                                                                                                                                                                                                                                                                                                                                   |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [showBadges](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#showBadges(kotlin.Boolean))`(`show:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Whether[badges](https://developer.android.com/reference/kotlin/android/app/NotificationChannel.html#canShowBadge())from notifications intercepted by DND are allowed on devices that support badging.                                                                                                                                                           |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [showFullScreenIntent](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#showFullScreenIntent(kotlin.Boolean))`(`show:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Whether[full screen intents](https://developer.android.com/reference/kotlin/android/app/Notification.html#fullScreenIntent:android.app.PendingIntent)that are intercepted by DND are shown.                                                                                                                                                 |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [showInAmbientDisplay](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#showInAmbientDisplay(kotlin.Boolean))`(`show:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Whether notification intercepted by DND are prevented from appearing on ambient displays on devices that support ambient display.                                                                                                                                                                                                           |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [showInNotificationList](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#showInNotificationList(kotlin.Boolean))`(`show:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Whether notification intercepted by DND are prevented from appearing in notification list views like the notification shade or lockscreen on devices that support those views.                                                                                                                                                          |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [showLights](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#showLights(kotlin.Boolean))`(`show:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Whether[notification lights](https://developer.android.com/reference/kotlin/android/app/NotificationChannel.html#shouldShowLights())from notifications intercepted by DND are blocked.                                                                                                                                                                          |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [showPeeking](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#showPeeking(kotlin.Boolean))`(`show:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Whether notifications intercepted by DND are prevented from peeking.                                                                                                                                                                                                                                                                                          |
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | [showStatusBarIcons](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#showStatusBarIcons(kotlin.Boolean))`(`show:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Whether notifications intercepted by DND are prevented from appearing in the status bar on devices that support status bars.                                                                                                                                                                                                                    |

## Public constructors

### Builder

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder()
```

## Public methods

### allowAlarms

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun allowAlarms(allow: Boolean): ZenPolicy.Builder
```

Whether to allow notifications with category[Notification.CATEGORY_ALARM](https://developer.android.com/reference/kotlin/android/app/Notification.html#CATEGORY_ALARM:kotlin.String)to play sounds and visually appear or to intercept them when DND is active. Disallowing alarms will mute the alarm stream when DND is active.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### allowAllSounds

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun allowAllSounds(): ZenPolicy.Builder
```

Allows all notifications to bypass DND and unmutes all streams.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### allowCalls

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun allowCalls(audienceType: Int): ZenPolicy.Builder
```

Whether to allow notifications with category[Notification.CATEGORY_CALL](https://developer.android.com/reference/kotlin/android/app/Notification.html#CATEGORY_CALL:kotlin.String)that match audienceType to play sounds and visually appear or to intercept them when DND is active.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ||
|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `audienceType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):callers that are allowed to bypass DND Value is[android.service.notification.ZenPolicy#PEOPLE_TYPE_UNSET](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy#PEOPLE_TYPE_UNSET:kotlin.Int),[android.service.notification.ZenPolicy#PEOPLE_TYPE_ANYONE](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy#PEOPLE_TYPE_ANYONE:kotlin.Int),[android.service.notification.ZenPolicy#PEOPLE_TYPE_CONTACTS](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy#PEOPLE_TYPE_CONTACTS:kotlin.Int),[android.service.notification.ZenPolicy#PEOPLE_TYPE_STARRED](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy#PEOPLE_TYPE_STARRED:kotlin.Int), or[android.service.notification.ZenPolicy#PEOPLE_TYPE_NONE](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy#PEOPLE_TYPE_NONE:kotlin.Int) |

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### allowConversations

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun allowConversations(audienceType: Int): ZenPolicy.Builder
```

Whether to allow conversation notifications (see[NotificationChannel.setConversationId(String, String)](https://developer.android.com/reference/kotlin/android/app/NotificationChannel.html#setConversationId(kotlin.String,%20kotlin.String))) that match audienceType to play sounds and visually appear or to intercept them when DND is active.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ||
|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `audienceType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):callers that are allowed to bypass DND Value is[android.service.notification.ZenPolicy#CONVERSATION_SENDERS_UNSET](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy#CONVERSATION_SENDERS_UNSET:kotlin.Int),[android.service.notification.ZenPolicy#CONVERSATION_SENDERS_ANYONE](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy#CONVERSATION_SENDERS_ANYONE:kotlin.Int),[android.service.notification.ZenPolicy#CONVERSATION_SENDERS_IMPORTANT](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy#CONVERSATION_SENDERS_IMPORTANT:kotlin.Int), or[android.service.notification.ZenPolicy#CONVERSATION_SENDERS_NONE](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy#CONVERSATION_SENDERS_NONE:kotlin.Int) |

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### allowEvents

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun allowEvents(allow: Boolean): ZenPolicy.Builder
```

Whether to allow notifications with category[Notification.CATEGORY_EVENT](https://developer.android.com/reference/kotlin/android/app/Notification.html#CATEGORY_EVENT:kotlin.String)to play sounds and visually appear or to intercept them when DND is active.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### allowMedia

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun allowMedia(allow: Boolean): ZenPolicy.Builder
```

Whether to allow media notifications to play sounds and visually appear or to intercept them when DND is active. Disallowing media will mute the media stream when DND is active.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### allowMessages

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun allowMessages(audienceType: Int): ZenPolicy.Builder
```

Whether to allow notifications with category[Notification.CATEGORY_MESSAGE](https://developer.android.com/reference/kotlin/android/app/Notification.html#CATEGORY_MESSAGE:kotlin.String)that match audienceType to play sounds and visually appear or to intercept them when DND is active.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ||
|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `audienceType` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):message senders that are allowed to bypass DND Value is[android.service.notification.ZenPolicy#PEOPLE_TYPE_UNSET](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy#PEOPLE_TYPE_UNSET:kotlin.Int),[android.service.notification.ZenPolicy#PEOPLE_TYPE_ANYONE](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy#PEOPLE_TYPE_ANYONE:kotlin.Int),[android.service.notification.ZenPolicy#PEOPLE_TYPE_CONTACTS](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy#PEOPLE_TYPE_CONTACTS:kotlin.Int),[android.service.notification.ZenPolicy#PEOPLE_TYPE_STARRED](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy#PEOPLE_TYPE_STARRED:kotlin.Int), or[android.service.notification.ZenPolicy#PEOPLE_TYPE_NONE](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy#PEOPLE_TYPE_NONE:kotlin.Int) |

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### allowPriorityChannels

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun allowPriorityChannels(allow: Boolean): ZenPolicy.Builder
```

Set whether priority channels are permitted to break through DND.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### allowReminders

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun allowReminders(allow: Boolean): ZenPolicy.Builder
```

Whether to allow notifications with category[Notification.CATEGORY_REMINDER](https://developer.android.com/reference/kotlin/android/app/Notification.html#CATEGORY_REMINDER:kotlin.String)to play sounds and visually appear or to intercept them when DND is active.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### allowRepeatCallers

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun allowRepeatCallers(allow: Boolean): ZenPolicy.Builder
```

Whether to allow repeat callers (notifications with category[Notification.CATEGORY_CALL](https://developer.android.com/reference/kotlin/android/app/Notification.html#CATEGORY_CALL:kotlin.String)that have recently called to play sounds and visually appear.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### allowSystem

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun allowSystem(allow: Boolean): ZenPolicy.Builder
```

Whether to allow system sounds to play when DND is active. Disallowing system sounds will mute the system stream when DND is active.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### build

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun build(): ZenPolicy
```

Builds the current ZenPolicy.

|                                                             Return                                                              ||
|----------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy) | This value cannot be`null`. |

### disallowAllSounds

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun disallowAllSounds(): ZenPolicy.Builder
```

Intercepts all notifications and prevents them from playing sounds when DND is active. Also mutes alarm, system and media streams. Notification channels can still play sounds only if they[can bypass DND](https://developer.android.com/reference/kotlin/android/app/NotificationChannel.html#canBypassDnd()). If no channels can bypass DND, the ringer stream is also muted.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### hideAllVisualEffects

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun hideAllVisualEffects(): ZenPolicy.Builder
```

Disallows notifications intercepted by DND from showing when DND is active.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### showAllVisualEffects

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun showAllVisualEffects(): ZenPolicy.Builder
```

Allows notifications intercepted by DND to show on all surfaces when DND is active.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### showBadges

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun showBadges(show: Boolean): ZenPolicy.Builder
```

Whether[badges](https://developer.android.com/reference/kotlin/android/app/NotificationChannel.html#canShowBadge())from notifications intercepted by DND are allowed on devices that support badging.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### showFullScreenIntent

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun showFullScreenIntent(show: Boolean): ZenPolicy.Builder
```

Whether[full screen intents](https://developer.android.com/reference/kotlin/android/app/Notification.html#fullScreenIntent:android.app.PendingIntent)that are intercepted by DND are shown.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### showInAmbientDisplay

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun showInAmbientDisplay(show: Boolean): ZenPolicy.Builder
```

Whether notification intercepted by DND are prevented from appearing on ambient displays on devices that support ambient display.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### showInNotificationList

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun showInNotificationList(show: Boolean): ZenPolicy.Builder
```

Whether notification intercepted by DND are prevented from appearing in notification list views like the notification shade or lockscreen on devices that support those views.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### showLights

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun showLights(show: Boolean): ZenPolicy.Builder
```

Whether[notification lights](https://developer.android.com/reference/kotlin/android/app/NotificationChannel.html#shouldShowLights())from notifications intercepted by DND are blocked.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### showPeeking

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun showPeeking(show: Boolean): ZenPolicy.Builder
```

Whether notifications intercepted by DND are prevented from peeking.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |

### showStatusBarIcons

Added in[API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun showStatusBarIcons(show: Boolean): ZenPolicy.Builder
```

Whether notifications intercepted by DND are prevented from appearing in the status bar on devices that support status bars.

|                                                                      Return                                                                      ||
|---------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [ZenPolicy.Builder](https://developer.android.com/reference/kotlin/android/service/notification/ZenPolicy.Builder#) | This value cannot be`null`. |