License handling

Activating a license

One of the following methods can be used to activate a license programmatically:

Here is an example how to activate a license using a serial number:

hardware_code = FaceLicense.get_host_hardware_code(LicenseHardwareCodeType.WINDOWS_OS)
print(f"Hardware code: {hardware_code}")

try:
    FaceLicense.activate_serial_key(hardware_code, serial_key, "[Computer name]", license_path)
    print("License activated successfully")
except FaceException as ex:
    print(ex.message)
string hardwareCode = FaceLicense.GetHostHardwareCode(LicenseHardwareCodeType.WindowsOs);

try
{
    FaceLicense.ActivateSerialKey(hardwareCode, "XXXX-XXXX-XXXX-XXXX", "[Computer name]", "id3Face.lic");
}
catch (FaceException ex)
{
    Console.WriteLine(ex.Message);
}
String hardwareCode = FaceLicense.getHostHardwareCode(LicenseHardwareCodeType.android);

try {
  FaceLicense.activateSerialKey(hardwareCode, "XXXX-XXXX-XXXX-XXXX", "[Computer name]", "id3Face.lic");
} catch (FaceException ex) {
  print(ex.message);
}
val hardwareCode = FaceLicense.getHostHardwareCode(LicenseHardwareCodeType.ANDROID)

try {
    FaceLicense.activateSerialKey(hardwareCode, "XXXX-XXXX-XXXX-XXXX", "[Computer name]", "id3Face.lic")
} catch (ex: FaceException) {
    println(ex.message)
}
int err;
char hwCode[256];
int hwCodeSize = 256;

err = id3FaceLicense_GetHostHardwareCode(id3FaceLicenseHardwareCodeType_WindowsOs, hwCode, &hwCodeSize, NULL);

if (err == id3FaceError_Success)
{
    int licenseBufferSize = 1024*1024;
    unsigned char *licenseBuffer = (unsigned char*)malloc(size);

    err = id3FaceLicense_ActivateSerialKeyBuffer(hwCode, "XXXX-XXXX-XXXX-XXXX", "[Computer name]", licenseBuffer, &licenseBufferSize);
}

Important

On Android and iOS platforms, it is not possible, for reasons of confidentiality, to retrieve a truly unique hardware identifier. The side effect is that the hardware code is different (but fixed) for every application you develop, even on the same device.

Hint

We recommend that you activate the application the first time you run it, and then store the license on the device for future use.

Warning

Internet usage permission is required for the activation process.

Checking the license

Before calling any function of the SDK, you need to check a valid license file first.

try:
    FaceLicense.check_license(license_path)
    print(f"License name    : {FaceLicense.get_license_name()}")
    print(f"License owner   : {FaceLicense.get_license_owner()}")
    print(f"License serial  : {FaceLicense.get_license_file_serial()}")
    print(f"License type    : {FaceLicense.get_license_type().name}")
    print(f"Hardware code   : {FaceLicense.get_license_file_hardware_code()}")
except FaceException as ex:
    print(ex.message)
try
{
    FaceLicense.CheckLicense("id3Face.lic");
}
catch (FaceException ex)
{
    Console.WriteLine(ex.Message);
}
try {
    FaceLicense.checkLicense("id3Face.lic");
}
catch (FaceException ex)
{
    print(ex.message);
}
try {
    FaceLicense.checkLicense("id3Face.lic")
} catch (ex: FaceException) {
    println(ex.message)
}
int err;

err = id3FaceLicense_CheckLicense("id3Face.lic", NULL);

if (err == id3FaceError_Success)
{
}

License modules

A license module gives access to some functionalities of the SDK as described below:

Module

Description

Face

Main module

FaceAttributes

Provides access to the FaceAnalyser Class

FaceEncoder

Provides access to the FaceEncoder Class

FaceGPU

Provides access to the GPU.

FaceMatcher

Provides access to the FaceMatcher Class

FacePAD

Provides access to the FacePad Class

ServerEdition

Identifies the server edition (Windows, Linux, Mac)

MobileEdition

Identifies the mobile edition (Android, iOS)

EdgeEdition

Identifies the edge edition (Raspberry PI)

Hint

In your application, call the FaceLicense.checkModule Method to find out whether a particular module is enabled in your license.

See also