---
title: "activateDevice(_:session:for:)"
framework: mediadevice
role: symbol
role_heading: Instance Method
path: "mediadevice/mediadeviceextension/activatedevice(_:session:for:)"
---

# activateDevice(_:session:for:)

Called when the user activates a device via a user interface.

## Declaration

```swift
@MainActor func activateDevice(_ device: MediaOutputDevice, session: MediaOutputSession, for deviceFeatures: MediaOutputDevice.Capabilities)
```

## Parameters

- `device`: The device to activate.
- `session`: The session associated with the activation.
- `deviceFeatures`: The capabilities requested for this activation.

## Mentioned in

Creating a media device extension

## Discussion

Discussion If the device requires additional user authentication, call requestPairingCode(for:session:reason:authorizationMethod:). The system will report user input via connectUsingPairingCode(_:to:session:). If the authorization fails, or the connection to the device fails, call failedToActivateDevice(_:session:error:). If the activation is successful, call activatedDevice(_:session:). Grouping If the extension receives multiple activations, then the associated MediaOutputDevice instances should be grouped together. If the devices are already members of a group, then those groups should now be considered grouped together. updateDevices(_:) should be called to update the state of group information.
