July 20 2012
05:00 Hours
There have been many threads on this forum pertaining to the correct use of this Library that I am utterly confused.
I have published two free apps
TweetChirp Assistant Help 2.0
TweetChirp Field Guide Help 1
The first one works with the Licensing Libary the second does not, even though I am using the same code.
I can use the same code because the apps are help apps for two other apps I have created - one is published and other is about to be published.
I always get with the first app, response Sub lc_Allow.......End Sub
I always get with the second app, response Sub lc_DontAllow...End Sub
I cannot upload my zipped apps because that would exposed my publicKey.
I must be doing something wrong.
What is the BEST way to use this Library? - 'The Bottom Line'
Ray Tesluk Port Hope Canada :sign0085:
Here is my code
05:00 Hours
There have been many threads on this forum pertaining to the correct use of this Library that I am utterly confused.
I have published two free apps
TweetChirp Assistant Help 2.0
TweetChirp Field Guide Help 1
The first one works with the Licensing Libary the second does not, even though I am using the same code.
I can use the same code because the apps are help apps for two other apps I have created - one is published and other is about to be published.
I always get with the first app, response Sub lc_Allow.......End Sub
I always get with the second app, response Sub lc_DontAllow...End Sub
I cannot upload my zipped apps because that would exposed my publicKey.
I must be doing something wrong.
What is the BEST way to use this Library? - 'The Bottom Line'
Ray Tesluk Port Hope Canada :sign0085:
Here is my code
B4X:
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