SDKs
...
v2
Samples

Features

7min

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.

Floating Features

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.

Checking Out a Floating Feature

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:

Go


The FloatingInUseCount field indicates how many devices are currently using that feature under this license.

Releasing a Floating Feature

To release a floating slot before the end of the floating period (for example, when shutting down the application), use the following:

Go


Releasing the slot will update both the local license data and the LicenseSpring platform, freeing the slot for other devices.

Consumption Features

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.

Local Consumption Update

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.

Go


The third argument to UpdateFeatureConsumption() controls whether the local file should be updated in addition to in-memory data, which is what we recommend.

Sync with LicenseSpring Server

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.
Go


After syncing:

  • TotalConsumptions will reflect the updated count on the LicenseSpring platform.
  • LocalConsumptions will be reset to 0.