Best Practices
These recommendations apply to any app integrating LexActivator or LexFloatClient, regardless of language or platform.
Choose the right permission flag
The flag you pass to SetProductId() determines where LexActivator stores activation data:
LA_USERis the default for regular desktop apps running with user privileges.LA_ALL_USERSshares a single activation across all OS users (system-wide activation). It is supported on Windows and macOS. On Linux, achieve the same result by pointing LexActivator at a system-wide directory withSetDataDirectory()and passing this flag.LA_IN_MEMORYkeeps all data in memory instead of on disk. Use it when your app has no write access to the disk, and for hosted floating licenses with a per-instance leasing strategy. Note that the license must be activated again every time the app restarts.
Verify locally, sync in the background
Every time your app starts, verify the license locally by checking the cryptographic signature of the stored activation with IsLicenseGenuine(). This works offline and adds no startup latency. The SDK then periodically syncs with the Cryptlex servers in a separate background thread, picking up server-side changes such as renewals, suspension, or revocation.
Configure a sensible server sync interval in your license template. If frequent syncing is not required, use 3600 seconds or greater, or one day (86400 seconds) to avoid generating a high volume of API requests.
Handle every license state
Do not treat license verification as a boolean. Your app should branch on the status codes and respond appropriately:
LA_OK: the license is valid.LA_EXPIRED: the license validity has ended; prompt for renewal.LA_SUSPENDED: the license was suspended server-side, for example for a failed payment; access is typically restored without reactivation.LA_GRACE_PERIOD_OVER: the SDK could not reach the Cryptlex servers for longer than the server sync grace period configured in the license template. Decide deliberately whether to block usage or degrade gracefully.LA_FAIL: the license is not activated or was revoked; require a fresh activation.
Activate on user action, not on every start
Call ActivateLicense() (or ActivateTrial()) once, ideally on a button click, when the user enters their key. Executing activation on every start unnecessarily contacts the Cryptlex servers; after activation, startup checks should rely on the local verification described above.
Release floating licenses promptly
For floating licenses, call DeactivateLicense() (LexActivator) or DropFloatingLicense() (LexFloatClient) when the user exits the app. Otherwise the seat stays leased and becomes a zombie license, unavailable to other users until the lease expires.
With LexFloatClient, the license lease renews itself automatically in a background thread, and your renewal callback is invoked from that background thread. Do not interact with UI elements directly from the callback; marshal back to the main thread using your framework's mechanism. If the renewal fails, request a new license from the callback.
Support restricted environments
- Customers behind corporate proxies usually need nothing: LexActivator detects system proxy settings automatically, and you can offer manual configuration via
SetNetworkProxy(). Restrictive firewalls need whitelisting. - For air-gapped machines, support offline activations, or deploy LexFloatServer inside the customer's network.
Ship the runtime dependencies
On older Windows versions (Windows 7, 8, Windows Server 2008/2012), the SDKs require the Microsoft Visual C++ 2015 (or later) runtime. Include the required DLLs with your installer, or install the latest Visual C++ Redistributable.
Before you ship
Walk through the Launch Checklist to verify your licensing model, test the failure paths, and secure your credentials.