---
name: ansight-migrate-sdk-1-1-capacitor
description: Migrate a Capacitor app from an older @ansight/capacitor pairing-config integration to SDK 1.1 zero-touch developer enrollment. Use when upgrading npm and native dependencies, deleting pairing JSON or host environment plumbing, simplifying initialization, or adding generic physical-device QR enrollment. Classic Apache Cordova is not a drop-in target.
---

# Migrate Capacitor to Ansight SDK 1.1

Upgrade the web bridge and matching native packages, remove pairing payload
plumbing, and use native zero-touch enrollment.

## Migration

1. Inspect `package.json`, web bootstrap, Capacitor config, native projects,
   development guard, pairing environment variables, and scanner UI.
2. Upgrade and synchronize:

```shell
npm install @ansight/capacitor@1.3.0-preview.10
npx cap sync
```

3. Remove pairing JSON, bundled payload environment values, generated native
   resources, host and Wi-Fi settings, certificate settings, and build-time
   desktop-host probes.
4. Remove startup calls that pass pairing JSON to `connect(...)`. Do not keep a
   compatibility fallback.
5. Initialize only for the intended development build:

```ts
await Ansight.initializeAndActivate(
  Ansight.createOptionsBuilder()
    .withAnsightDefaults()
    .build(),
);
```

6. Add a developer-only physical-device action:

```ts
await Ansight.enrollFromQrCode({
  clientName: "My Capacitor App",
});
```

7. If the app already owns a scanner, pass its scanned text to `connect(...)`
   instead of adding a second scanner.

## Native version alignment

The package expects matching CocoaPods and Maven artifacts at
`1.3.0-preview.10`. Run `npx cap sync`, rebuild both native projects, and inspect
lockfiles if an older package remains selected.

## Permissions

Android requires no app camera permission for the SDK scanner. On iOS, add
`NSCameraUsageDescription` for scanning and `NSLocalNetworkUsageDescription`
for direct device access. Add no ATS exception or unrelated permissions.

## Verification

Run the package checks and web build, synchronize native projects, and build
both development targets. With `ansight host run` active, verify automatic emulator and
Simulator enrollment, a single CLI QR scan per physical
installation, automatic reconnect after relaunch, and disabled developer tools
in production bundles.

Run `ansight pairing issue --qr` for physical enrollment and confirm
each target with `ansight session list --connected --app-id <app-id> --json`.
