Sub Process_Globals
.
.
.
Dim publicKey As String
publicKey = "MIIBIjANBgkqh....."
Dim s_Test As String
End Sub
Sub Globals
.
.
.
Dim lc As LicenseChecker
End Sub
Sub Activity_Create(FirstTime As Boolean)
.
.
.
lc.Initialize("lc", GetDeviceId, publicKey, "qwertyuiopa".GetBytes("UTF8"))
lc.SetVariableAndValue("s_Test",SlideShow.sSecret)
lc.CheckAccess
End Sub
Sub lc_Allow
Log("lc_Allow->Allow")
ToastMessageShow(s_Test & " lc_Allow", True)
End Sub
Sub lc_DontAllow
Log("lc_DontAllow->DontAllow")
ToastMessageShow(s_Test & " lc_DontAllow", True)
'Activity.Finish
End Sub
Sub lc_Error (ErrorCode As String)
Log("lc_Error->ErrorCode " & ErrorCode)
ToastMessageShow(ErrorCode & " " & s_Test & " lc_Error", True)
'Activity.Finish
End Sub
Sub GetDeviceId As String
Dim r As Reflector
Dim Api As Int
Api = r.GetStaticField("android.os.Build$VERSION", "SDK_INT")
If Api < 9 Then 'Old device
If File.Exists(File.DirInternal, "__id") Then
Return File.ReadString(File.DirInternal, "__id")
Else
Dim id As Int
id = Rnd(0x10000000, 0x7FFFFFFF)
File.WriteString(File.DirInternal, "__id", id)
Return id
End If
Else 'New device
Return r.GetStaticField("android.os.Build", "SERIAL")
End If
End Sub