Licence Check only works on my device


Well-Known Member
Licensed User

I am using the Licence library and I have followed the steps in the Licence library Tutorial from here:

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..

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"))
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")
          Dim id As Int
         id = Rnd(0x10000000, 0x7FFFFFFF)
         File.WriteString(File.DirInternal, "__id", id)
         Return id
      End If
      'New device
      Return r.GetStaticField("android.os.Build", "SERIAL")
    End If
End Sub

Sub lc_Allow
    ToastMessageShow("Allow", True)
End Sub

Sub lc_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:

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?


  • console_screenshot.png
    91.5 KB · Views: 165


Well-Known Member
Licensed User
The app runs, but when it does the license check it fails, and stops the app from running as it has failed.

I have a ToastMessageShow and it comes up saying NOT_MARKET_MANAGED
However the email/gmail account that this phone (the one with the problem) has been added to the test accounts in the Google Developer Console.

Soon as I take the license check part of the code away it runs normally (but doesn't do the license, as its been removed)

I did notice that on the Google Developer Console it says:

Test Accounts
Comma-separated list of additional Gmail addresses (aside from ) that will get the License Test Response from applications you manage. These users will also be able to make in-app-billing purchases from uploaded, unpublished applications you manage.

Then under that it has:
License Test Response
This License Test Response will be sent to devices using or the Test Accounts listed above for applications you have uploaded to Google Play. Additionally, this account (but not the Test Accounts) will receive this response for applications that have not yet been uploaded to Google Play.

(I removed my email from above)

Does this mean my test accounts won't work with the 'License Test Response' unless I upload my app to Google Play?

I have added emails in the 'test accounts' part but it only allows my gmail account to work.

I have also set the License Test Response to Licensed

Any ideas?
Last edited:
Upvote 0


Well-Known Member
Licensed User
Still not working..

This is what I have done:

Used all the code as per post 1.
Uploaded the apk to Google Play (saved it rather than clicking publish)

Haven't added any test accounts..

Gave the file to a mate to install.

It installed fine, and run fine. So something went wrong as it should of said not allowed.

If he installs the app but turns all internet off before running the app on his device it somes up saying it failed as there is no internet connection to check Google. (so I know its connecting to google for checking)

I have the License Test Response set to 'Not_License' but still allows people to run the app when it should come back not allowed.

However, it stops me from installing the app (and my device is using the developer console gmail account)

I then added his email into the test accounts (he uninstalled if first) but still allows him to run the app, but stops me.

If i change it to 'Licensed' in the developer console it allows me to run the app (as I am using the developer gmail account)

Shouldn't it stop people running the app?
Am I doing somethng wrong?
Last edited:
Upvote 0


Well-Known Member
Licensed User

Soon as I uploaded and published the app to Google play it then works like its meant to.

Looks like I had to upload it to Google play first before the test accounts work in Google play.
Upvote 0

Similar Threads

  • Article
Android Code Snippet Change CheckBox colors
  • Question
Android Question Licence