Skip to content

Activating the license#

To integrate LUNA ID with your project and use its features, you need to activate the license.

In LUNA ID for Android#

You can activate the license using one of the following methods:

Activating license via license.conf#

To activate the license:

1․ Request license parameters

Obtain the following parameters from VisionLabs:

  • Server - The URL of the license server.
  • EID - A unique identifier for your application.
  • ProductID - The product identifier for LUNA ID.

For details, see License parameters.

2․ Specify parameters in license.conf

Add the received parameters to the license.conf file and save the changes.

Example structure of license.conf

Below is an example structure of the file:

<?xml version="1.0"?>
<settings>
        <section name="Licensing::Settings">
                <param name="Server" type="Value::String" text="https://example-license-server.com"/>
                <param name="EID" type="Value::String" text="your-eid-here"/>
                <param name="ProductID" type="Value::String" text="your-product-id-here"/>
                <param name="Filename" type="Value::String" text="license.dat"/>
                <param name="ContainerMode" type="Value::Int1" x="0"/>
                <param name="ConnectionTimeout" type="Value::Int1" x="15"/>
                <param name="licenseModel" type="Value::Int1" x="2" />
        </section>
</settings>

3․ Place license.conf in your project

Save the license.conf file in the assets/data/license.conf directory of your project.

The license key will be generated and saved to the specified directory. The license file has a binary format. At the next launch of the mobile app on the same device, the license will be read from this file.

4․ Activate the license

Call the initEngine() method to initialize LUNA ID and activate the license.

Below is an example implementation:

private fun initLunaSdk() {
    val baseUrl = "url"
    val token = "token"
    val headers = mapOf("Authorization" to token)
    val apiHumanConfig = ApiHumanConfig(baseUrl, headers)
    val lunaConfig = LunaConfig.create(
        acceptOccludedFaces = true,
        acceptOneEyed = false,
        acceptEyesClosed = false,
        detectFrameSize = 350,
        skipFrames = 36,
        ags = 0.2f,
        bestShotInterval = 500,
        detectorStep = 1,
        usePrimaryFaceTracking = true,
        glassesChecks = setOf(GlassesCheckType.GLASSES_CHECK_SUN)
    )

    LunaID.initEngine(
        app = this@App, 
        lunaConfig = lunaConfig, 
        apiHumanConfig = apiHumanConfig
    )
}

Note: The parameters in the example are set to default values. Adjust them according to your requirements.

Key components of the example code

The example code has the following components:

Component Description
baseUrl A variable that specifies the URL to LUNA PLATFORM 5. For details, see Interaction of LUNA ID with LUNA PLATFORM 5.
token A variable that specifies a LUNA PLATFORM 5 token, which will be transferred to a request header from LUNA ID.
headers A map that specifies headers that will be added to each request to be sent to LUNA PLATFORM 5.
apiHumanConfig An optional configuration parameter for calling the LUNA PLATFORM 5 API. Can be set to null if no LUNA PLATFORM 5 API calls are required. This will also disable the Online OneShotLiveness estimation, regardless of the onlineLivenessSettings argument.
ApiHumanConfig A class required for configuration to call the LUNA PLATFORM 5 API.
lunaConfig An argument to be passed for best shot parameters.
LunaConfig A class that describes best shot parameters.
acceptOccludedFaces A parameter that specifies whether an image with an occluded face will be considered the best shot. For details, see Getting the best shot with an occluded face.
acceptOneEyed A parameter that specifies whether blinking with one eye is enabled.
acceptEyesClosed A parameter that specifies whether an image with two closed eyes will be considered the best shot. For details, see Getting the best shot with faces with closed eyes.
detectFrameSize A parameter that specifies a face detection bounding box size.
skipFrames A parameter that specifies a number of frames to wait until a face is detected in the face recognition area before video recording is stopped.
ags A parameter that specifies a source image score for further descriptor extraction and matching. For details, see AGS.
bestShotInterval A parameter that specifies a minimum time interval between best shots.
detectorStep A parameter that specifies a number of frames between frames with full face detection.
usePrimaryFaceTracking A parameter that specifies whether to track the face that was detected in the face recognition area first. For details, see Tracking face identity.
glassesChecks A parameter that specifies what images with glasses can be best shots. For details, see Getting the best shot with faces with occluded eyes.
LunaID.initEngine A method that activates the LUNA ID license.

5․ Subscribe to initialization events

Subscribe to events from the LunaID.engineInitStatus flow to monitor the initialization process:

LunaID.engineInitStatus.flowWithLifecycle(this.lifecycle, Lifecycle.State.STARTED)
.onEach {
    if(it is LunaID.engineInitStatus.InProgress) {
   // LUNA ID is loading
   }else if(it is LunaID.engineInitStatus.Success) {
   // LUNA ID is ready
    }
}.flowOn(Dispatchers.Main)
.launchIn(this.lifecycleScope)

Now, you can start the camera and proceed with embedding LUNA ID functionality in your app.

For a detailed example, see App.kt.

Activating license via LunaConfig.licenseParams#

The LunaConfig.licenseParams parameter allows you to specify license activation details directly within the configuration object.

Important notes#

  • This method overrides the license.conf file if both are present.
  • If the parameter is not defined, that is set to null, the system will fall back to using the license.conf file embedded during the APK build process.

Configuration details#

The licenseParams parameter is of type LicenseParams, which includes the following fields:

Parameter Type Description
server String Specifies the URL of the license server.
eId String A unique identifier for your application.
productId String The product identifier for LUNA ID.
licenseModel LicenseModel Defines the license to be used.
        val license = LicenseParams("server", "eId", "productId", LicenseModel.ZEUS)
        val lunaConfig = LunaConfig.create(licenseParams = license)
        LunaID.initEngine(
            app = this@App,
            lunaConfig = lunaConfig,
            apiHumanConfig = apiHumanConfig
        )

In LUNA ID for iOS#

Activating license via vllicense.plist#

To activate the license:

1․ Request license parameters

Obtain the following parameters from VisionLabs:

  • Server - The URL of the license server.
  • EID - A unique identifier for your application.
  • ProductID - The product identifier for LUNA ID.

For details, see License parameters.

2․ Specify parameters in vllicense.plist

Add the received parameters to the vllicense.plist file and save the changes.

Example structure of vllicense.plist

Below is an example structure of the file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>ContainerMode</key>
    <real>0</real>
    <key>ConnectionTimeout</key>
    <integer>15</integer>
    <key>Filename</key>
    <string>license.dat</string>
    <key>ProductID</key>
    <string>your-product-id-here</string>
    <key>EID</key>
    <string>your-eid-here</string>
    <key>Server</key>
    <string>https://example-license-server.com</string>
    <key>ServerRetriesCount</key>
    <integer>1</integer>
    <key>UseZeus</key>
    <true/>
</dict>
</plist>

3․ Add vllicense.plist to your app

The license key will be generated and saved to the specified directory. The license file has a binary format. At the next launch of the mobile app on the same device, the license will be read from this file.

Renaming vllicense.plist#

You can optionally rename the vllicense.plist file. To do this, change the default value, which is vllicense.plist, of the LCLunaConfiguration::plistLicenseFileName property.