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 = FingerLicense.get_host_hardware_code(LicenseHardwareCodeType.WINDOWS_OS)
print(f"Hardware code : {hardware_code}")
try:
FingerLicense.activate_serial_key(hardware_code, license_key, hostname, license_path)
print("License activated successfully")
except id3finger.FingerException as ex:
print(f"License activation failed: {ex}")
String hardwareCode = FingerLicense.getHostHardwareCode(LicenseHardwareCodeType.android);
try {
FingerLicense.activateSerialKey(hardwareCode, "XXXX-XXXX-XXXX-XXXX", "[Computer name]", "id3Finger.lic");
} catch (FingerException ex) {
print(ex.message);
}
string hardwareCode = FingerLicense.GetHostHardwareCode(LicenseHardwareCodeType.WindowsOs);
try
{
FingerLicense.ActivateSerialKey(hardwareCode, "XXXX-XXXX-XXXX-XXXX", "[Computer name]", "id3Finger.lic");
}
catch (FingerException ex)
{
Console.WriteLine(ex.Message);
}
String hardwareCode = FingerLicense.getHostHardwareCode(LicenseHardwareCodeType.LINUX_OS);
try {
FingerLicense.activateSerialKey(hardwareCode, "XXXX-XXXX-XXXX-XXXX", "[Computer name]", "id3Finger.lic");
} catch (FingerException ex) {
System.out.println(ex.getMessage());
}
val hardwareCode = FingerLicense.getHostHardwareCode(LicenseHardwareCodeType.ANDROID)
try {
FingerLicense.activateSerialKey(hardwareCode, "XXXX-XXXX-XXXX-XXXX", "[Computer name]", "id3Finger.lic")
} catch (ex: FingerException) {
println(ex.message)
}
int err;
char hwCode[256];
int hwCodeSize = 256;
err = id3FingerLicense_GetHostHardwareCode(id3FingerLicenseHardwareCodeType_WindowsOs, hwCode, &hwCodeSize, NULL);
if (err == id3FingerError_Success)
{
int licenseBufferSize = 1024*1024;
unsigned char *licenseBuffer = (unsigned char*)malloc(size);
err = id3FingerLicense_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:
FingerLicense.check_license(license_path)
print(f"License name : {FingerLicense.get_license_name()}")
print(f"License owner : {FingerLicense.get_license_owner()}")
print(f"License serial : {FingerLicense.get_license_file_serial()}")
print(f"License type : {FingerLicense.get_license_type().name}")
print(f"Hardware code : {FingerLicense.get_license_file_hardware_code()}")
except id3finger.FingerException as ex:
print(f"License check failed: {ex}")
try {
FingerLibrary.checkLicense("id3Finger.lic");
}
catch (FingerException ex)
{
print(ex.message);
}
try
{
FingerLibrary.CheckLicense("id3Finger.lic");
}
catch (FingerException ex)
{
Console.WriteLine(ex.Message);
}
try {
FingerLibrary.checkLicense("id3Finger.lic");
} catch (FingerException ex) {
System.out.println(ex.getMessage());
}
try {
FingerLibrary.checkLicense("id3Finger.lic")
} catch (ex: FingerException) {
println(ex.message)
}
int err;
err = id3FingerLicense_CheckLicense("id3Finger.lic", NULL);
if (err == id3FingerError_Success)
{
}