To enable activations, you just need to have the LicenseSpot framework installed. We always recommend that you implement activations in your application. To do so, just use the Activation() method on the framework.
Get the public key
The first step before implementing activations is to get your public key. This key is already configured in your LicenseSpot and was created when you signed up. This key will help with the validation of the license and we check that your customer hasn’t tampered the license in any way.
To get the public key, to the key pair screen in LicenseSpot, click on the default public key created and copy it into the clipboard:
Adding activation to you application
To activate your application, you need to send to LicenseSpot the serial number the customer is using to activate the app. This serial number was sent to the customer when they bought your product or requested to download a trial.
To activate your app, you can use the Activate() method in the framework:
ExtendedLicense license = ExtendedLicenseManager.GetLicense(typeof(Form1), this, "you public key"); license.Activate("serial number");
Dim license as ExtendedLicense license = ExtendedLicenseManager.GetLicense(Me.GetType(), Me, "your public key") license.Activate("serial number")
What this method does is that it’ll contact the LicenseSpot servers and will check if the serial number exists in the system. If it does, it’ll check that the serial number supports activations, it’ll then check that it has activations left and if it does, it’ll add an activation to the serial number.
The framework will then receive the response from LicenseSpot which is basically the contents of the license and it’ll save a copy of the file locally in c:\ProgramData\IPManager. The license will have a .lic extension.
Validating the activation
To validate that the activation is active and that the local license hasn’t been tampered by the customer, you’ll use the IsGenuineEx() method of the framework.
GenuineResult result = license.IsGenuineEx();
Dim result as GenuineResult = license.IsGenuineEx()
This method will check the local license file that it’s still valid and that the customer didn’t try to change it. Then it’ll try to connect to the LicenseSpot server to check that the activation hasn’t been deactivated or that the license isn’t in a revoke status. The method will return one of the following three values:
- Genuine: it means the license is valid and it’s in good standing on the LicenseSpot server
- NotGenuine: the license or activation isn’t valid. Something is wrong and the customer shouldn’t be allowed to user the application.
- InternetError: it means that the LicenseSpot framework is unable to connect to the server to validate the license. You should either delay the validation for sometime (next day for example) to the customer a chance to connect or inform him/her about the issue.