LicenseManager
The LicenseManager class provides a set of APIs to manage the licensing for the Dynamsoft Capture Vision architecture.
API | Description |
---|---|
static getDeviceUUID |
Returns the unique identifier of the device. |
static initLicense |
Initializes the license for the application using a license key. |
static setDeviceFriendlyName |
Assigns a distinctive name to the device, correlating it with its UUID. |
getDeviceUUID
Returns the unique identifier of the device.
static getDeviceUUID(): Promise<string>;
Return Value
A promise which, upon resolution, yields a string corresponding to the device’s UUID.
initLicense
Initializes the license for the application using a license key. This function is overloaded, providing two different usages based on the provided parameters.
static initLicense(license: string, immediately?: boolean): void | Promise<void>;
Parameters
license
: The license key to be used for initialization.
immediately
: A boolean flag that determines if the function should immediately execute the license initialization or not.
Return Value
void
-
When
immediately
is undefined or false, this signature ofinitLicense
passes the license key to the application for initialization at a later stage. It doesn’t provide immediate feedback and is suitable for scenarios where immediate confirmation of license initialization is not required. -
When
immediately
is true, this returns a promise that resolves when the operation finishes. It does not provide any value upon resolution. Please note that it may raise up license related exceptions.
Code snippet
Dynamsoft.License.LicenseManager.initLicense("your-license-key", true)
.then(result => {
if (result?.message) {
console.log("License Message:", result.message);
} else {
console.log("License initialized successfully");
}
})
.catch(error => {
console.error("License initialization failed:", error);
});
setDeviceFriendlyName
Assigns a distinctive name to the device, correlating it with its UUID.
Please be aware that this method must be called before
Dynamsoft.CVR.CaptureVisionRouter.createInstance()
orDynamsoft.Core.CoreModule.loadWasm()
orDynamsoft.DCP.CodeParser.createInstance()
to take effect.
static setDeviceFriendlyName(name: string): void;
Parameters
name
: A string representing the device which is easier to recognize than its UUID.
Return Value
void