Android Programming Press on the image to return to the main documentation page.

Licensing

List of types:

LicenseChecker

LicenseChecker

LicenseChecker allows you to add protection to your application and check whether the user is allowed to access your application.
See the tutorial for more information.

Permissions:

com.android.vending.CHECK_LICENSE

Events:

Allow
DontAllow
Error (ErrorCode As String)

Members:


  CheckAccess

  Initialize (EventName As String, DeviceId As String, PublicKey As String, Salt() As Byte)

  SetVariableAndValue (Variable As String, Value As String)

Members description:

CheckAccess
Checks whether the user is allowed to access the application.
One of the events will be raised when the result is available.
Initialize (EventName As String, DeviceId As String, PublicKey As String, Salt() As Byte)
Initializes the object.
EventName - Sets the subs that will handle the events.
DeviceId - A unique id that is used to encrypt the cached result.
PublicKey - The publisher key as shown in your publisher account.
Salt - A "random" array of bytes that is used during encryption / decryption.
Example:
lc.Initialize("lc", PhoneId.GetDeviceId, PUBLIC_KEY, "kljsdflkj".GetBytes("UTF8"))
SetVariableAndValue (Variable As String, Value As String)
The given value will be assigned to the given variable if the license check was successful.
Preferably you should use this variable data in a later stage. This helps to prevent a hacker from hacking your application by removing the license check code.
Variable - The name of a process global string variable (in the main activity).
Value - The value that will be assigned to the variable if the check was successful.
Example:lc.SetVariableAndValue("NameOfSomeVariable", "Value")
Top