Device Variables Usage
Device variables play a crucial role in LicenseSpring's SDKs by facilitating the exchange of data from devices to the vendor platform.
This mechanism allows developers and administrators to gather real-time device-specific information, empowering them to make informed decisions and tailor licensing strategies based on accurate insights.
The aim of this section is to provide you with a comprehensive understanding of effectively utilizing device variables.
- 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.
- Implemented routine local and online checks within the application.
Some examples of scenarios where device variables are useful:
Device variables can be utilized to capture and transmit hardware specifications, such as CPU type, RAM size, and storage capacity.
This information can be invaluable for tailoring licenses based on the user's hardware capabilities.
User registration data includes names and user information, which can be sent and kept track of on the LicenseSpring platform using these variables.
This enables you to gather and manage essential user details directly within the licensing framework, streamlining administrative tasks and enhancing user experience.
Store user preferences, settings, and configurations using device variables to create a more personalized and seamless user experience.
Integrating device variables is simple with the LicenseSpring SDK, and on existing licenses can be done in three different ways:
- Adding a name-value pair
- Adding a DeviceVariable object
- Adding multiple DeviceVariable objects via vector/array.
Note: To update a device variable, you can simply add the device variable with the same name, and it’s updated value.
Device variables can also be set on license activation:
To locate the device variables through the vendor platform, first navigate to your license then to the "Devices" tab.
Next, click on the device variables button to open a list of the device's device variables.
Note: The SDKs have the ability to retrieve device variables from either the local license or from the backend. The Boolean that is passed as the parameter into the getDeviceVariables function decides where they are retrieved from.
True gets the device variables from the backend, whereas False searches the local license.
By default, this false is set to false. If no parameters are passed to this method, it will retrieve from the local license.