diff --git a/src/main/java/com/cryptlex/lexactivator/LexActivator.java b/src/main/java/com/cryptlex/lexactivator/LexActivator.java index f2eff46..aa63f66 100644 --- a/src/main/java/com/cryptlex/lexactivator/LexActivator.java +++ b/src/main/java/com/cryptlex/lexactivator/LexActivator.java @@ -1865,6 +1865,34 @@ public static int IsLicenseValid() throws LexActivatorException { } } + /** + * Synchronizes the activation data with the Cryptlex servers. The license must already + * be activated when this function is called. This is a blocking call that performs a + * one-time synchronization to refresh the local license data. In most cases, rely on + * IsLicenseGenuine(), which automatically handles periodic background synchronization + * based on the configured interval. Note: Do not use this function in regular + * application flow. Use it only when an immediate synchronization is required. + * + * @return LA_OK, LA_EXPIRED, LA_SUSPENDED, LA_FAIL + * @throws LexActivatorException + */ + public static int SyncLicenseActivation() throws LexActivatorException { + int status; + status = LexActivatorNative.SyncLicenseActivation(); + switch (status) { + case LA_OK: + return LA_OK; + case LA_EXPIRED: + return LA_EXPIRED; + case LA_SUSPENDED: + return LA_SUSPENDED; + case LA_FAIL: + return LA_FAIL; + default: + throw new LexActivatorException(status); + } + } + /** * Starts the verified trial in your application by contacting the Cryptlex * servers. This function should be executed when your application starts first @@ -1889,6 +1917,33 @@ public static int ActivateTrial() throws LexActivatorException { } } + /** + * Synchronizes the trial activation data with the Cryptlex servers. The trial must + * already be activated when this function is called. This is a blocking call that + * performs a one-time synchronization to refresh the local trial data. Unlike + * IsTrialGenuine(), which validates the trial activation locally, this function + * performs an immediate synchronization with the servers. Note: Use this + * function to immediately reflect server-side changes on the user's machine, such as + * trial extensions. + * + * @return LA_OK, LA_TRIAL_EXPIRED, LA_FAIL + * @throws LexActivatorException + */ + public static int SyncTrialActivation() throws LexActivatorException { + int status; + status = LexActivatorNative.SyncTrialActivation(); + switch (status) { + case LA_OK: + return LA_OK; + case LA_TRIAL_EXPIRED: + return LA_TRIAL_EXPIRED; + case LA_FAIL: + return LA_FAIL; + default: + throw new LexActivatorException(status); + } + } + /** * Activates the trial using the offline activation response file. * diff --git a/src/main/java/com/cryptlex/lexactivator/LexActivatorNative.java b/src/main/java/com/cryptlex/lexactivator/LexActivatorNative.java index 5c0abf0..4e219ab 100644 --- a/src/main/java/com/cryptlex/lexactivator/LexActivatorNative.java +++ b/src/main/java/com/cryptlex/lexactivator/LexActivatorNative.java @@ -277,8 +277,12 @@ public interface ReleaseUpdateCallbackTypeA extends Callback { public static native int IsLicenseValid(); + public static native int SyncLicenseActivation(); + public static native int ActivateTrial(); + public static native int SyncTrialActivation(); + public static native int ActivateTrialOffline(String filePath); public static native int ActivateTrialOffline(WString filePath);