Skip to content

# Activating the SDK License

An activation code is required to use the Nix Universal SDK. The license determines:

- Which device types are available for discovery and connection.
- Which features and data types are available for connected devices.

By default, all Nix device operations are disabled. It is necessary to activate the license before these are made available to the host application.

## Obtaining a license key

Free evaluation codes are available for non-commercial use. To obtain an activation code, visit to the SDK license page.

## Using the License Manager

License operations are handled via `LicenseManager.Shared` (see Kotlin or Java APIs).

### Activating the license

A license is activated by calling `LicenseManager.Shared.activate()` (see Kotlin or Java). This method takes the license options and signature strings as arguments and returns the activation result as a `LicenseManagerState` value (see Kotlin or Java).

Note

License activations remain valid within a single session, but do not persist across different application launches. Therefore, it is required to call `activate()` at least once per session.

Kotlin Java

    // Application context, in a Fragment use getContext()
    val context: Context = applicationContext

    // Update these string values to match your provided license
    val options = "REPLACE_WITH_LICENSE_OPTIONS"
    val signature = "REPLACE_WITH_LICENSE_SIGNATURE"

    // Result is returned as a `LicenseManagerState` enum
    val activationState = LicenseManager.activate(
        context = context,
        options = options,
        signature = signature)

    // Application context, in a Fragment use getContext()
    Context context = getApplicationContext();

    // Update these string values to match your provided license
    String options = "REPLACE_WITH_LICENSE_OPTIONS";
    String signature = "REPLACE_WITH_LICENSE_SIGNATURE";

    // Result is returned as a `LicenseManagerState` enum
    LicenseManagerState activationState = LicenseManager.Shared.activate(
        context,
        options,
        signature);

Tip

The license manager state can also be checked at any time via: `LicenseManager.Shared.getState()` (see Kotlin or Java).

Device operations are only available if the resulting state is equal to `LicenseManagerState/ACTIVE`. All other values indicate an error state. Refer to the `LicenseManagerState` Kotlin or Java API documentation for further details.

Warning

You can switch licenses by calling `activate()` repeated times within a single session. Doing so will invalidate any open device connections. Any connected Nix devices will need to be disconnected and discovered again using a `DeviceScanner` after switching licenses.

### Other license properties

Additional license properties can be queried on `LicenseManager.Shared`. Note that some properties may be blank or empty depending on your license capabilities.

Kotlin Java

- UUID
  - Unique ID for your SDK license.
  - Refer to `LicenseManager.uuid`
- Expiry date
  - Indicates when the current license ceases to be valid.
  - Refer to `LicenseManager.expiry`
- Allocation codes
  - List of pre-authorized device allocation codes, used when accessing private labelled Nix devices.
  - May be empty for general use cases.
  - Refer to `LicenseManager.allocations`
- Allowed device types
  - List of Nix device types that are supported by the current license.
  - Refer to `LicenseManager.allowedDeviceTypes` and `LicenseManager.isDeviceTypeSupported()`
- Enabled features
  - List of SDK features enabled by the current license.
  - Refer to `LicenseManager.features` and `LicenseManager.isFeatureEnabled()`
- SDK version
  - Indicates the current version of the Nix Universal SDK.
  - Refer to `LicenseManager.libraryVersion`

- UUID
  - Unique ID for your SDK license.
  - Refer to `LicenseManager.Shared.getUuid()`
- Expiry date
  - Indicates when the current license ceases to be valid.
  - Refer to `LicenseManager.Shared.getExpiry()`
- Allocation codes
  - List of pre-authorized device allocation codes, used when accessing private labelled Nix devices.
  - May be empty for general use cases.
  - Refer to `LicenseManager.Shared.getAllocations()`
- Allowed device types
  - List of Nix device types that are supported by the current license.
  - Refer to `LicenseManager.Shared.getAllowedDeviceTypes()` and `LicenseManager.Shared.isDeviceTypeSupported()`
- Enabled features
  - List of SDK features enabled by the current license.
  - Refer to `LicenseManager.Shared.getFeatures()` and `LicenseManager.Shared.isFeatureEnabled()`
- SDK version
  - Indicates the current version of the Nix Universal SDK.
  - Refer to `LicenseManager.Shared.getLibraryVersion()`

## Next steps

- Discovering and Connecting to Nix Devices