checkLicense static method

void checkLicense(
  1. String? licensePath
)

Checks a license from a file. This function does two things:

  • First it loads the license from a file using the given path
  • Then it checks the validity of the license regarding the host it is called on (Windows, Linux, Android ...) Important: Calling this function is required to get access to the license member getters. Note: The optional parameter is required on Android and must be the JNIEnv* pointer casted as a void*. It can be set as NULL for other devices.

param licensePath Absolute or relative path to the license file. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

static void checkLicense(String? licensePath) {
  Pointer<Char>? pLicensePath = licensePath?.toNativeUtf8().cast<Char>();
  Pointer<Void> pOptionalParameter = nullptr;
		if (Platform.isAndroid) {
			pOptionalParameter = getJniEnvPtr();
		}
  try {
    var err = biosealSDK.id3BiosealLicense_CheckLicense(pLicensePath ?? nullptr, pOptionalParameter);
    if (err != BiosealError.success.value) {
      throw BiosealException(err);
    }
  } finally {
    if (pLicensePath != null) {
      calloc.free(pLicensePath);
    }
  }
}