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.

Prerequisites

1

Complete the Getting Started tutorial

You should have completed the Getting Started tutorial, including:

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

Understanding Device Variable Usage

Some examples of scenarios where device variables are useful:

Hardware Specifications

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.

Tracking User Registration Data

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.

User Preferences

Store user preferences, settings, and configurations using device variables to create a more personalized and seamless user experience.

Adding Device Variables

Integrating device variables on existing licenses can be done in three different ways.

1

Adding a name-value pair

2

Adding a DeviceVariable object

3

Adding multiple DeviceVariable objects via vector/array

circle-info

Note: To update a device variable, you can simply add the device variable with the same name and its updated value.

Device variables can also be set on license activation:

Accessing Device Variables

To locate the device variables through the vendor platform, first navigate to your license then to the "Devices" tab.

Device tab where device variables are found.

Next, click on the device variables button to open a list of the device's device variables.

Device Variables button
circle-info

Note: The SDKs can retrieve device variables from either the local license or from the backend. The Boolean parameter passed into the getDeviceVariables function decides where they are retrieved from:

  • true gets the device variables from the backend.

  • false gets them from the local license.

By default, this parameter is false. If no parameter is passed to this method, it will retrieve from the local license.

Last updated

Was this helpful?