Skip to content

Updating the license#

This topic explains how to dynamically update the license in LUNA ID.

In LUNA ID for Android#

To dynamically update the license, pass the license file to the LunaID.initEngine method. Below is an example:

val config = LunaConfig.create(
    // other configuration options...
)

LunaID.initEngine(
        app: Application,
        lunaConfig: LunaConfig,
        apiHumanConfig: ApiHumanConfig? = null,
        license : File? = null,
        timeoutMillis : Long = 30_000L
    )
Key components of the example code

The example code has the following components:

Component Description
lunaConfig An argument to be passed for best shot parameters.
license An instance of java.io.File. If this parameter is not provided, the system will use the default license.conf file located in the project.
timeoutMillis The timeout for license activation, with a default value of 30 seconds (30,000 milliseconds).

Important notes:

  • The license must be updated before initializing LUNA ID.
  • If changes are made after initialization, you must restart the app or re-initialize the engine with the new configuration.

In LUNA ID for iOS#

You can dynamically update the license using the LCLicenseConfig class. Populate its fields with the required data and pass it during the initialization of the LUNA ID engine.

Important: The responsibility for providing the required license data lies with the client application, which retrieves the values from its server and populates the fields of the configuration class.

Below is an example of how to configure and populate LCLicenseConfig class:

var newConfig = LunaCore.LCLicenseConfig()
newConfig.eid = "your_entitlement_id"
newConfig.productID = "your_product_id"

These values are then passed to the LunaConfig object during engine initialization:

let config = LCLunaConfiguration()
config.licenseConfig = newConfig

LunaID.initEngine(config)