Hello,
I am using the Licence library and I have followed the steps in the Licence library Tutorial from here: http://www.b4x.com/forum/basic4android-getting-started-tutorials/11429-protect-your-android-application-licensing-library.html
The problem I am faced with is that it works fine on my device running in debug mode. I then created it as Released(obfuscated).
I then uninstalled if off my device, then installed the new one onto my device and the licence checked worked.
However, When I give it to people to try the licence check failed.
In the Google Developer Console, I have clicked on 'Edit profile' then added the emails of the devices that are going to install the app to in the 'Test Accounts' input box. (as shown in the attached Image)
When they run the app it comes up saying that the licence check failed.
This is how I have added it to my app, and hoping someone can help me out and find where I have gone wrong..
I have noticed in the tutorial it shows the code:
but I am not too sure how to use it.
Everything seems to work on my device but the only differences is that my devices are using my devloper console gmail adddress and the others are not, but I have added those devices to the test accounts in the Developer Console, but it still doesn't work on those devices and only works on mine.
They all have internet access on the devices as they where able to download the app, it seems to install the app but won't run the app.
Have I missed something and that is why it's not working?
I haven't yet submitted this app yet to the Google Play Store, just downloaded the app onto those devices for testing, or does it need to be submitted to the google play store for it to work?
I am using the Licence library and I have followed the steps in the Licence library Tutorial from here: http://www.b4x.com/forum/basic4android-getting-started-tutorials/11429-protect-your-android-application-licensing-library.html
The problem I am faced with is that it works fine on my device running in debug mode. I then created it as Released(obfuscated).
I then uninstalled if off my device, then installed the new one onto my device and the licence checked worked.
However, When I give it to people to try the licence check failed.
In the Google Developer Console, I have clicked on 'Edit profile' then added the emails of the devices that are going to install the app to in the 'Test Accounts' input box. (as shown in the attached Image)
When they run the app it comes up saying that the licence check failed.
This is how I have added it to my app, and hoping someone can help me out and find where I have gone wrong..
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim publicKey As String
publicKey = "MIIBIjANBg....." 'removed some for posting..
End Sub
Sub Activity_Create(FirstTime As Boolean)
' check for licence
Dim lc As LicenseChecker
Dim p As PhoneId
lc.Initialize("lc", GetDeviceId, publicKey, "kljdflkf".GetBytes("UTF8"))
lc.CheckAccess
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
Sub lc_Allow
Log("Allow")
ToastMessageShow("Allow", True)
End Sub
Sub lc_DontAllow
Log("DontAllow")
ToastMessageShow("Don't Allow", True)
End Sub
Sub lc_Error (ErrorCode As String)
Log("error: " & ErrorCode)
ToastMessageShow("Error", True)
End Sub
I have noticed in the tutorial it shows the code:
B4X:
lc.SetVariableAndValue("test1", "some secret value")
but I am not too sure how to use it.
Everything seems to work on my device but the only differences is that my devices are using my devloper console gmail adddress and the others are not, but I have added those devices to the test accounts in the Developer Console, but it still doesn't work on those devices and only works on mine.
They all have internet access on the devices as they where able to download the app, it seems to install the app but won't run the app.
Have I missed something and that is why it's not working?
I haven't yet submitted this app yet to the Google Play Store, just downloaded the app onto those devices for testing, or does it need to be submitted to the google play store for it to work?