IsLicenseGenuine static method

int IsLicenseGenuine()

It verifies whether your app is genuinely activated or not. Returns LexStatusCodes LA_OK, LA_EXPIRED, LA_SUSPENDED, LA_GRACE_PERIOD_OVER, and LA_FAIL.

The verification is done locally by verifying the cryptographic digital signature fetched at the time of activation. After verifying locally, it schedules a server check in a separate thread. After the first server sync it periodically does further syncs at a frequency set for the license.

In case server sync fails due to network error, and it continues to fail for fixed number of days (grace period), the function returns LA_GRACE_PERIOD_OVER instead of LA_OK. This function must be called on every start of your program to verify the activation of your app.

Note: If application was activated offline using ActivateLicenseOffline() function, you may want to set grace period to 0 to ignore grace period.

The function throws a LexActivatorException on error.

Implementation

static int IsLicenseGenuine() {
  int status = _lexActivatorNative.IsLicenseGenuine();

  switch (status) {
    case LexStatusCodes.LA_OK:
      return LexStatusCodes.LA_OK;
    case LexStatusCodes.LA_EXPIRED:
      return LexStatusCodes.LA_EXPIRED;
    case LexStatusCodes.LA_SUSPENDED:
      return LexStatusCodes.LA_SUSPENDED;
    case LexStatusCodes.LA_GRACE_PERIOD_OVER:
      return LexStatusCodes.LA_GRACE_PERIOD_OVER;
    case LexStatusCodes.LA_FAIL:
      return LexStatusCodes.LA_FAIL;
    default:
      throw LexActivatorException(status);
  }
}