---
title: New Device Activation
description: This page explains how to use a client state to authenticate the user and bind a new device for ongoing two-factor authentication.
component: recognize
page_id: recognize:mobile-sdk:mobile-sdk-new-device-activation
canonical_url: https://docs.pingidentity.com/recognize/mobile-sdk/mobile-sdk-new-device-activation.html
llms_txt: https://docs.pingidentity.com/recognize/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
section_ids:
  recover-from-client-state: Recover from Client State
  android: Android
  ios: iOS
  flutter: Flutter
  react-native: React Native
---

# New Device Activation

## Recover from Client State

Pass the client state created during enrollment flow or via IDV Bridge to recover the account on a new device. Use the client state you obtained and stored securely when enrolling users via IDV Bridge or Mobile SDK.

|   |                                                                                                                                       |
| - | ------------------------------------------------------------------------------------------------------------------------------------- |
|   | When enrolling from client state, PingOne Recognize shows the enrollment UI to users (from SDK 5.0.1 onward), including live filters. |

### Android

```kotlin
// clientState retrieved from previous step
val clientState = "<your_client_state>"

val enrollConfig = BiomEnrollConfig(clientState = clientState)

Keyless.enroll(
  configuration = enrollConfig,
  onCompletion = { result ->
    when (result) {
      is Keyless.KeylessResult.Success -> {
        // account recovered
        val userId = result.value.userId
      }
      is Keyless.KeylessResult.Failure -> Log.d("KeylessSDK ", "error code ${result.error.code}")
    }
  }
)
```

### iOS

```swift
// clientState retrieved from previous step
let clientState = "<your_client_state>"

let enrollConfig = BiomEnrollConfig(clientState: clientState)

Keyless.enroll(
  configuration: enrollConfig,
  onCompletion: { result in
    switch result {
    case .success(let enrollSuccess):
      // account recovered
      let userId = enrollSuccess.userId

    case .failure(let error):
      print("error code: \(error.code)")
    }
  }
)
```

### Flutter

```dart
import 'package:keyless_flutter_sdk/keyless.dart';
import 'package:keyless_flutter_sdk/models/configurations/enrollment_configuration.dart';

// temporaryState retrieved from previous step
final temporaryState = "<your_temporary_state>";

final enrollConfig = BiomEnrollConfig(temporaryState: temporaryState);

try {
  final result = await Keyless.instance.enroll(enrollConfig);
  // account recovered
  print("Account recovered successfully. UserID: ${result.keylessId}");
} catch (error) {
  print("Account recovery failed: $error");
}
```

### React Native

```text
const clientState = '<your_client_state>';

const config = new BiomEnrollConfig({
  clientState: clientState,
});

const result = await Keyless.enroll(config);
result.fold({
  onSuccess(data) {
    logConsole('Enroll result success ' + JSON.stringify(data, null, 2));
  },
  onFailure(error) {
    logConsole('Enroll result failure ' + JSON.stringify(error, null, 2));
  },
});
```

After account recovery, it is possible to continue authenticating the user with ongoing two-factor authentication.
