Time-Limited
In this guide, you'll learn how to manage time-limited licenses using the LicenseSpring SDKs.
This includes understanding validity periods, detecting license expiry with methods like "isExpired," implementing local checks, and gaining insights into remaining days for effective software access management.
By mastering these strategies, you can enhance your software distribution through precise time-based licensing techniques.
- Initialized LicenseManager (or LicenseHandler) with your configuration using the appropriate settings.
- Created a LicenseID using either LicenseID::fromKey or LicenseID::fromUser function, depending on the activation method you prefer.
- Activated a license of any type.
Upon configuring a new product in LicenseSpring, you gain the ability to set the default validity period for generated license keys.
This validity period signifies the duration in days between the initial activation of the license key and its expiration.
Note: A license key can be configured for perpetual validity or restricted within a specific time frame.
With our SDK, obtaining the validity period of a license key in your local time zone becomes a seamless process.
The validity period is stored within the License object and can be accessed by using the following method:
Developers also have the ability to get the validity period in UTC, rather than local time.
This is done with the following:
By employing our system, you can easily determine whether a license has expired or remains valid.
This process empowers you with accurate information to manage software access effectively, ensuring a seamless user experience.
The isExpired() method provides an efficient way to check whether a license has reached its expiration date.
Our SDKs offer the ability to check the expiration status through the use of the following License methods:
Note: Our Java SDK's isExpired() method is called on the LicenseData object.
A local license check involves assessing the validity and expiration status of a software license within the immediate operating environment.
By performing checks locally, the software verifies the license's authenticity and expiration status without relying on external connections.
If the local license is expired, the SDKs will throw the following exceptions:
See License Checks for more information about local license checks.
Developers can also access a field within the License object that holds the number of days remiaining until the license expires.
This number of days can be retrieved using the following methods, in the current time zone and UTC, respectively:
Note: The Java SDK only offers the ability to retrieve the days remaining in the current time zone.