SDK Initialization
The SDK behaves as a singleton — initialize it only once and reuse it. As soon as you initialize the SDK, it will contact the LicenseSpring server to check if there is an existing license for the current device / product combination.
If a license is available, it will be immediately accessible as a License object. During initialization the LicenseManager will try to read the license information from the specified license file and validate it with the license server. If successful, LicenseManager.getCurrent() will return a License object with detailed license information.
At minimum, you must provide three parameters to initialize the SDK:
apiKey— your company API keyproductCode— a two-letter string identifying the product (application)sharedKey— company-specific encryption key used when signing requests
All of these values are available in the LicenseSpring web platform under the "SDK integration" section.
Build configuration
Create a LicenseSpringConfiguration with the required values (and optional app metadata):
LicenseSpringConfiguration configuration = LicenseSpringConfiguration.builder()
.apiKey("api_key")
.productCode("product_code")
.sharedKey("shared-key")
.appName("My application")
.appVersion("1.0.0")
.build();Initialize LicenseManager
Get the singleton instance and initialize it with the configuration and application context:
LicenseManager manager = LicenseManager.getInstance();
manager.initialize(configuration, getApplicationContext());After initialization, the SDK will attempt to read and validate any existing license; if present, it will be exposed via LicenseManager.getCurrent().
Was this helpful?