---
title: "setExposureNotificationEnabled(_:completionHandler:)"
framework: exposurenotification
role: symbol
role_heading: Instance Method
path: "exposurenotification/enmanager/setexposurenotificationenabled(_:completionhandler:)"
---

# setExposureNotificationEnabled(_:completionHandler:)

Enables or disables exposure notification.

## Declaration

```swift
func setExposureNotificationEnabled(_ enabled: Bool, completionHandler: @escaping @Sendable ((any Error)?) -> Void)
```

```swift
func setExposureNotificationEnabled(_ enabled: Bool) async throws
```

## Parameters

- `enabled`: A Boolean that enables or disables exposure notification.
- `completionHandler`: The completion handler that the framework calls once exposure notification is enabled or disabled.

## Discussion

Discussion important: You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration: func setExposureNotificationEnabled(_ enabled: Bool) async throws For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously. important: This method is available in iOS 12.5, and in iOS 13.5 and later. If the user hasn’t authorized exposure notification, this method displays a user dialog requesting consent. note: Using this method to disable exposure notification stops scanning and Bluetooth advertising, but diagnosis keys and data remain.

## See Also

### Activating the Manager

- [activate(completionHandler:)](exposurenotification/enmanager/activate(completionhandler:).md)
- [activityHandler](exposurenotification/enmanager/activityhandler.md)
- [ENActivityHandler](exposurenotification/enactivityhandler.md)
- [ENActivityFlags](exposurenotification/enactivityflags.md)
