Features
Licenses in our SDK support features. A license can contain multiple features; each with its own behavior and rules. These features can be of different types, such as floating or consumption.
In the case of floating features, the SDK provides functionality similar to floating licenses. A floating feature allows a client to check out a floating slot for a limited time (the floating period), after which the slot expires unless explicitly released earlier.
Both the local license file and the LicenseSpring platform will reflect the current status of floating slots in use.
To occupy a floating slot for a feature, use CheckLicenseFeature. Once called, the SDK will store the updated slot usage locally, and you can inspect it using GetFeature(featureCode) on the license data:
The FloatingInUseCount field indicates how many devices are currently using that feature under this license.
To release a floating slot before the end of the floating period (for example, when shutting down the application), use the following:
Releasing the slot will update both the local license data and the LicenseSpring platform, freeing the slot for other devices.
Features of the consumption type allow your application to consume usage limits tied to that feature. These consumptions may be limited or unlimited, depending on how the feature is configured in the LicenseSpring platform.
Similar to consumption licenses, consumption-based features support local usage updates that can later be synced to the cloud.
To register the consumption of a feature locally (i.e., increase usage before syncing to the cloud), use the UpdateFeatureConsumption() method. This updates the LocalConsumptions field in your locally stored license file.
The third argument to UpdateFeatureConsumption() controls whether the local file should be updated in addition to in-memory data, which is what we recommend.
To commit the locally recorded consumption to the LicenseSpring backend, call SyncFeatureConsumption().
You can provide:
- One or more feature codes to sync specific features.
- No arguments to sync all consumption features at once.
After syncing:
- TotalConsumptions will reflect the updated count on the LicenseSpring platform.
- LocalConsumptions will be reset to 0.