# AI API Reference For XmobiTea DeviceId

Read this only when exact symbols or signatures matter.

Required import for consumer code:

```csharp
using XmobiTea.MiniDeviceId;
```

## Supported Public API

| Signature | Returns | Use for |
| --- | --- | --- |
| `public static string CXDevice.GetDeviceId()` | platform-produced identifier string | all consumer reads |

`CXDevice.GetDeviceId()` delegates to the active platform `Implement.Get()` selected by asmdef platform filters.

## Supported Consumer Pattern

```csharp
var deviceId = CXDevice.GetDeviceId();
```

The returned string is opaque. Caller code may check for `string.IsNullOrEmpty(deviceId)` if the product requires defensive handling, but the package does not expose a richer result type.

## Implementation-Visible Symbols

These symbols exist in package assemblies but are not the supported integration surface for consumer code.

| Symbol | Visibility | Agent rule |
| --- | --- | --- |
| `Implement.Get()` | public implementation class in platform-specific assemblies | Do not call directly from consumer code |
| `CustomId` | public serializable payload type in the Apple-path assembly, with JSON fields `userId` and `uuid` | Do not use as an app data model |
| `CXKeyChain.BindGetKeyChainUser()` | internal | Not accessible from external assemblies |
| `CXKeyChain.BindSetKeyChainUser(userId, uuid)` | internal | Not accessible from external assemblies |
| `CXKeyChain.BindDeleteKeyChainUser()` | internal | Not accessible from external assemblies |

If code generation needs a device identifier, always route through `CXDevice.GetDeviceId()`.

## Assembly Selection

| Assembly | Platforms | Notes |
| --- | --- | --- |
| `com.xmobitea.changx.mini-deviceid.runtime` | all targets | exposes `CXDevice` and references the platform assembly |
| `com.xmobitea.changx.mini-deviceid.runtime.Default` | all except `iOS`, `macOSStandalone`, `tvOS`, `WebGL` | returns `SystemInfo.deviceUniqueIdentifier` |
| `com.xmobitea.changx.mini-deviceid.runtime.WebGL` | `WebGL` | stores a generated GUID in `PlayerPrefs` |
| `com.xmobitea.changx.mini-deviceid.runtime.iOS` | `iOS`, `macOSStandalone`, `tvOS` | C# keychain bridge path; native implementation sources under `Plugins/iOS` are imported for iOS and tvOS, not macOS standalone |

There is one active platform implementation at compile time for a target group.

Native keychain entries use keys `UserID` and `UserUUID`; the JSON payload exposed to C# uses fields `userId` and `uuid`.
