# Managing full device mode

### Managing full device state from the SDKs

In some situations it is useful to be able to switch a Cobrowse session into full device mode using the SDK. For example, if you would like sessions to default to full device mode, or enforce full device mode is always (or never) used. We provide an API for doing this:

{% tabs %}
{% tab title="Web" %}

```javascript
await session.setFullDevice('requested')
```

{% endtab %}

{% tab title="iOS / MacOS" %}
**Swift**

```swift
session.setFullDevice(.requested)
```

**Objective-C**

```objectivec
[session setFullDevice: CBIOFullDeviceStateRequested callback:nil];
```

{% endtab %}

{% tab title="Android" %}

```java
session.setFullDevice(Session.FullDeviceState.Requested, (err, arg) -> {
    // handle error
});
```

{% endtab %}

{% tab title="React Native" %}

```javascript
await session.setFullDevice('requested')
```

{% endtab %}

{% tab title="Flutter" %}

```dart
Session? session = await CobrowseIO.instance.currentSession();
if (session != null) {
    try {
        await session.setFullDevice(FullDeviceState.on);
    } on PlatformException catch (e) {
        // E.g. a network error
        log('Cannot update the full device state: ${e.message}');
    }
}
```

{% endtab %}

{% tab title=".NET Mobile" %}

```cs
Session session = CobrowseIO.Instance.CurrentSession;
if (session != null)
{
    session.SetFullDevice(FullDeviceState.On, (err, session) =>
    {
        if (err != null)
        {
            // E.g. a network error
        }
        else
        {
            // Full device mode is activated
        }
    });
}
```

{% endtab %}
{% endtabs %}

See this in action: <https://github.com/cobrowseio/cobrowse-sdk-js-examples#full-device-mode-by-default>.

These APIs can be used in combination with our various [delegate APIs](/sdk-features/listening-for-events.md) to switch the session in and out of full device mode as your use case requires.

For example, to request full device is used by default, you can set the full device state when the session is first loaded by the SDK:

{% tabs %}
{% tab title="Web" %}

```javascript
CobrowseIO.on('session.loaded', session => session.setFullDevice('requested')) 
```

{% endtab %}

{% tab title="iOS / MacOS" %}
**Swift**

```swift
// You must have implmented the CobrowseIODelegate
func cobrowseSessionDidLoad(_ session: CBIOSession) {
    session.setFullDevice(.requested)
}
```

**Objective-C**

```objectivec
// You must have implmented the CobrowseIODelegate
- (void)cobrowseSessionDidLoad:(CBIOSession *)session {
    [session setFullDevice: CBIOFullDeviceStateRequested callback:nil];
}
```

{% endtab %}

{% tab title="Android" %}

```java
// note: you must have implmented CobrowseIO.SessionLoadDelegate
@Override
public void sessionDidLoad(@NonNull Session session) {
    session.setFullDevice(Session.FullDeviceState.Requested, null);
}
```

{% endtab %}

{% tab title="React Native" %}

```javascript
CobrowseIO.addListener('session.loaded', session => {
    console.log('A session was loaded', session)
    await session.setFullDevice(true)
})
```

{% endtab %}

{% tab title="Flutter" %}

```dart
CobrowseIO.instance.sessionDidLoad.listen((session) {
    try {
        await session.setFullDevice(FullDeviceState.on);
    } on PlatformException catch (e) {
        // E.g. a network error
        log('Cannot update the full device state: ${e.message}');
    }
});
```

{% endtab %}

{% tab title=".NET Mobile" %}

```dart
CobrowseIO.Instance.SessionDidLoad += (sender, session) =>
{
    session.SetFullDevice(FullDeviceState.On, (err, session) =>
    {
        if (err != null)
        {
            // E.g. a network error
        }
        else
        {
            // Full device mode is activated
        }
    });
};
```

{% endtab %}
{% endtabs %}

### Controlling full device state from the Agent SDK

You may also set the full device state using the Agent SDK. See the Agent SDK [API Reference](/agent-side-integrations/agent-sdk/api-reference.md) for more details.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cobrowse.io/sdk-features/full-device-capabilities/switching-to-full-device-mode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
