SDKs
Android SDK

LicenseManager

12min
after completing sdk initialization docid\ mzbr0pezzqzpoz2lkgita , there are a number of methods and objects available to the app developer getcurrent() in case no active license is available the property value will be null license currentlicense = licensemanager getcurrent(); gettriallicense(string email) you can generate a trial key directly from the app using the sdk, which will automatically associate this license key with the provided email you can later use this data from the licensespring platform to send out email campaigns targeting trial users for example after you generate a trial key the unactivatedtriallicense object will be returned, you still need to activate it using a call to licensemanager activatelicense() try { unactivatedtriallicense trial = licensemanager gettriallicense("someemail\@gmail com"); license license = licensemanager activatelicense(trial createidentity()); } catch(licensespringexception e) { log error("something went wrong",e); return; } activatelicensekey(activationlicense identity) attempts to activate the product using provided activationidentity returns the license object that has been activated // keybased activationlicense keybased = activationlicense fromkey("license key"); license activated = licensemanager activatelicense(keybased); // or username/pass based note that this is the only api which requires the password // licensespring will never store user passwords via the sdk activationlicense userbased = activationlicense fromusername("username", "password"); license activated = licensemanager activatelicense(userbased); deactivatelicense(licenseidentity identity) license is deactivated using a method on the manager you need to supply the current license identity boolean isdeactivated = licensemanager deactivatelicense(licenseidentity fromkey("sample key")); getinstallationfile(licenseidentity identity) returns the latest valid installation file, if installation files are defined in the licensespring platform for more details please see product versioning docid\ sz5imovmj5qjawhelsoxt installationfile installationfile = licensemanager getinstallationfile(licenseidentity fromkey("sample key")); getversions(licenseidentity identity) returns all available versions of the product app that are specified in licensespring platform for more details please see product versioning docid\ sz5imovmj5qjawhelsoxt version class only contains string version trackvariables(licenseidentity identity, map\<string, string> variables) tracks device based variables for end uses can use the variable builder as a utility // build your own map licensemanager trackvariables(licenseidentity fromkey("sample key"), new hashmap<>); // use utility class to add some variables and track them devicevariables devicevars = devicevariables builder() variable("one", "some value") variable("another var", "other value") build(); licensemanager trackvariables(licenseidentity fromkey("sample key"), devicevars getvariables()); getproduct() gets product details from licensespring servers product product = licensemanager getproductdetails(); log info(product getproductname()); log info(product getshortcode()); log info(product isallowtrial()); log info(product gettrialdays()); log info(product getauthorizationmethod()); getairgapactivationcode gets the activation code use for air gapped license needs the licensespringconfiguration field airgappedpublickey to work with air gap licenses airgappedactivation activation = licensemanager getairgapactivationcode( &#x9;licenseidentity fromkey("sample key"), "initializationcodefromplatform" ); log info(activation getactivationcode()); log info(activation gethardwareid()); log info(activation getlicensekey()); activateairgapresponse activates the air gapped license from the license policy file needs the licensespringconfiguration field airgappedpublickey to work with air gap licenses license license = licensemanager activateairgapresponse( &#x9;licenseidentity fromkey("sample key"), "pathtopolicyfile", "policyid" ); log info(license gethardwareid()); log info(license getidentity() getlicensekey()); verifyairgapconfirmationcode verifies the confirmation code for air gapped license needs the licensespringconfiguration field airgappedpublickey to work with air gap licences boolean verified = licensemanager verifyairgapconfirmationcode( &#x9;licenseidentity fromkey("sample key"), "policyidfromplatform", "confirmationcodefromplatform" ); log info(verified);