+
diff --git a/src/main/java/io/cryptolens/methods/Helpers.java b/src/main/java/io/cryptolens/methods/Helpers.java
index 54ba9a3..2a8c2ae 100644
--- a/src/main/java/io/cryptolens/methods/Helpers.java
+++ b/src/main/java/io/cryptolens/methods/Helpers.java
@@ -13,6 +13,10 @@
/**
* A collection of helper methods that operate on a license key.
+ *
+ * If you are using cryptolens-android.jar, please avoid using
+ * GetMachineCode and all versions of IsOnRightMachine that do not
+ * take in a custom machine code string.
*/
public class Helpers {
@@ -28,7 +32,8 @@ public static String GetMachineCode() {
/**
* Check if the device is registered with the license key.
- * @returns True if the license is registered with this machine and False otherwise.
+ * @param license The license key object.
+ * @return True if the license is registered with this machine and False otherwise.
*/
public static boolean IsOnRightMachine(LicenseKey license) {
return IsOnRightMachine(license, false);
@@ -36,9 +41,10 @@ public static boolean IsOnRightMachine(LicenseKey license) {
/**
* Check if the device is registered with the license key.
+ * @param license The license key object.
* @param isFloatingLicense If this is a floating license, this parameter has to be set to true.
* You can enable floating licenses by setting @see ActivateModel.FloatingTimeInterval.
- * @returns True if the license is registered with this machine and False otherwise.
+ * @return True if the license is registered with this machine and False otherwise.
*/
public static boolean IsOnRightMachine(LicenseKey license, boolean isFloatingLicense) {
return IsOnRightMachine(license, isFloatingLicense, false);
@@ -52,7 +58,7 @@ public static boolean IsOnRightMachine(LicenseKey license, boolean isFloatingLic
* @param allowOverdraft If floating licensing is enabled with overdraft, this parameter should be set to true.
* You can enable overdraft by setting ActivateModel.MaxOverdraft" to a value greater than 0.
*
- * @returns True if the license is registered with this machine and False otherwise.
+ * @return True if the license is registered with this machine and False otherwise.
*/
public static boolean IsOnRightMachine(LicenseKey license, boolean isFloatingLicense, boolean allowOverdraft) {
@@ -67,7 +73,7 @@ public static boolean IsOnRightMachine(LicenseKey license, boolean isFloatingLic
* @param license The license key object.
* @param machineCode The machine code of the current device.
*
- * @returns True if the license is registered with this machine and False otherwise.
+ * @return True if the license is registered with this machine and False otherwise.
*/
public static boolean IsOnRightMachine(LicenseKey license, String machineCode) {
return IsOnRightMachine(license, machineCode, false, false);
@@ -81,7 +87,7 @@ public static boolean IsOnRightMachine(LicenseKey license, String machineCode) {
* @param isFloatingLicense If this is a floating license, this parameter has to be set to true.
* You can enable floating licenses by setting @see ActivateModel.FloatingTimeInterval.
*
- * @returns True if the license is registered with this machine and False otherwise.
+ * @return True if the license is registered with this machine and False otherwise.
*/
public static boolean IsOnRightMachine(LicenseKey license, String machineCode, boolean isFloatingLicense) {
return IsOnRightMachine(license, machineCode, isFloatingLicense, false);
@@ -97,7 +103,7 @@ public static boolean IsOnRightMachine(LicenseKey license, String machineCode, b
* @param allowOverdraft If floating licensing is enabled with overdraft, this parameter should be set to true.
* You can enable overdraft by setting ActivateModel.MaxOverdraft" to a value greater than 0.
*
- * @returns True if the license is registered with this machine and False otherwise.
+ * @return True if the license is registered with this machine and False otherwise.
*/
public static boolean IsOnRightMachine(LicenseKey license, String machineCode, boolean isFloatingLicense, boolean allowOverdraft) {
diff --git a/src/main/java/io/cryptolens/methods/Key.java b/src/main/java/io/cryptolens/methods/Key.java
index 03c6c61..8f77ea8 100644
--- a/src/main/java/io/cryptolens/methods/Key.java
+++ b/src/main/java/io/cryptolens/methods/Key.java
@@ -11,8 +11,26 @@
import java.util.Map;
/**
- * A collection of methods that operate on a license key. Please see a complete
- * list here: https://app.cryptolens.io/docs/api/v3/Key
+ * A collection of methods that operate on a license key. Please see a complete
+ * list here.
+ *
+ * Note (for Android): it's important to run these methods asynchronously, as shown below:
+ *
+ * Thread thread = new Thread(new Runnable() {
+ * @Override
+ * public void run() {
+ * // call eg. Key.Activate(...).
+ * }
+ * });
+ *
+ *
+ * Moreover, the manifest file needs to have internet permission, which can be added as shown below:
+ *
+ * <uses-permission android:name="android.permission.INTERNET"/\>
+ *
+ * <application ....
+ *
+ *
*/
public class Key {
@@ -34,8 +52,12 @@ public static LicenseKey Activate (String token, String RSAPubKey, ActivateModel
ActivateResult result = HelperMethods.SendRequestToWebAPI("key/activate", model, extraParams, ActivateResult.class);
- if(result.result == 1) {
- System.err.println("The server returned an error: " + result.message);
+ if(result == null || result.result == 1) {
+ if(result != null) {
+ System.err.println("The server returned an error: " + result.message);
+ } else {
+ System.err.println("The server returned an error.");
+ }
return null;
}
@@ -57,8 +79,12 @@ public static boolean Deactivate (String token, DeactivateModel model) {
BasicResult result = HelperMethods.SendRequestToWebAPI("key/deactivate", model, extraParams, BasicResult.class);
- if(result.result == 1) {
- System.err.println("The server returned an error: " + result.message);
+ if(result == null || result.result == 1) {
+ if(result != null) {
+ System.err.println("The server returned an error: " + result.message);
+ } else {
+ System.err.println("The server returned an error.");
+ }
return false;
}
diff --git a/src/main/java/io/cryptolens/models/LicenseKey.java b/src/main/java/io/cryptolens/models/LicenseKey.java
index 0d49b47..257d182 100644
--- a/src/main/java/io/cryptolens/models/LicenseKey.java
+++ b/src/main/java/io/cryptolens/models/LicenseKey.java
@@ -57,6 +57,7 @@ public String SaveAsString() {
* Note, signature verification will be performed under the hood.
* @param RSAPubKey Your RSA Public Key, which can be found here.
* @param licenseString The license key object stored as a string.
+ * @return A license key object from the 'licenseString'.
*/
public static LicenseKey LoadFromString(String RSAPubKey, String licenseString) {
return LoadFromString(RSAPubKey, licenseString, -1);