Google Licensing Errors

Hi,

Is anyone else experiencing problems with Google Licensing? I recently updated a couple of apps to include the same licensing code I’ve used in others (which worked) and users have been complaining of errors. My code is as follows… am I missing something? I’ve followed all the code examples / checked the forums and can’t find anything obviously wrong.

if ("Android" == system.getInfo("platformName")) and (system.getInfo("targetAppStore") == "google") and checkLicense == 1 then verifyLicense(); else loadApp(); end

function verifyLicense() local licensing = require "licensing" licensing.init( "google" ) local function licensingListener( event )   local verified = event.isVerified; if (event and (not event.isError) and (not event.isVerified)) then     native.showAlert( "Licensing Failed!", "Error message here...", { "OK" } )   else loadApp(); end end licensing.verify( licensingListener ); end

In my build.settings file:

usesPermissions ={     "android.permission.INTERNET",     "com.android.vending.CHECK\_LICENSE" },

And in my config.lua:

license = {    google = {        key = "MY\_KEY\_HERE",     }, },

There’s nowhere else I need to add anything as far as I’m aware…?

Thanks,

Ian

Do you need to include:

“com.android.vending.BILLING”

or whether the policy needs to be server managed or not?:

        google =
        {
            key = “KEY”,
            – This is optional, it can be strict or serverManaged(default).
            – stric WILL NOT cache the server response so if there is no network access then it will always return false.
            – serverManaged WILL cache the server response so if there is no network access it can use the cached response.
            policy = “serverManaged”,
        },

Thanks for the quick response.

I thought the server policy was defaulted to “serverManaged” so didn’t need including but I can definitely give it a try. Not sure on the com.android.vending.BILLING but will add it and see if that helps.

Cheers.

Also, what sort of errors are you getting?

The error is essentially that it’s coming back as not verified, so this section is running the alert rather than loadApp():

if (event and (not event.isError) and (not event.isVerified)) then     native.showAlert( "Licensing Failed!", "Error message here...", { "OK" } )   else     loadApp(); end

I can’t reproduce though - this is coming from a customer. They say they’re definitely connected to the web and have no problems with other apps bought from the Play Store.

Interesting! Its a little tricky to diagnose without being able to reproduce it, but you could throw up a series of dialog boxes to display the event values to determine if the error is there.

Are other users complaining of this error or just this one? Do you have a device that you can test it on?

It’s just one user. She says she’s definitely connected to the web and is having no problem with other apps. When I test the licensing using Google Play’s Beta testing functionality I can run the app fine. I can also download and run the version that’s live in the app store no problems, so the licensing seems to be working for me.

I’ll post back if I get anywhere with it. Thanks for your help to date.

I also had to remove the licensing check for some apps because I got the feedback it isn’t working correctly and I couldn’t find any changes. It has worked before but the update seems to cause problems. I have used build 2015.2744 btw.

I’ve had more users complain of this - as with d.mach I made no code changes - it just stopped working.

Has this been confirned? We are experiencing same issues…

Any news on this?

BUILD 2016.2830

my biz app (version 2) is now crashing on my Android tablet after the initial screen (menu.lua) appears. Version 1, published on Google and Apple Stores, is fine and works as advertised on either device.

Now menu.lua (my first displayed screen after main.lua) opens but immediately closes down on my Android device. This is not happening on my apple device.

Versions 1 & 2 are on the same build.

ISSUE RESOLVED BY REMOVING GOOGLE LICENSING CODE

I removed the following code (Google Licensing Code) from main.lua and my app is now stable on my Android device. Note that this same code was included on Version 1 and successfully worked on the version uploaded to Google PlayStore.

if string.sub(system.getInfo("architectureInfo"),1,3) == "ARM" and var.developer==false then local licensing = require( "licensing" ) licensing.init( "google" ) local function licensingListener( event )     local verified = event.isVerified     if not event.isVerified then        --failed verify app from the play store, we print a message        print( "Pirates: Walk the Plank!!!" )        native.requestExit()  --assuming this is how we handle pirates     end end licensing.verify( licensingListener ) end

The above code, temporarily removed from Version 2, is in main.lua - but the Android device’s screen that displays is the screen directed to at the conclusion of main.lua. The initial screen shows for about .50 second - and then the entire app disappears on the Android. This doesn’t happen on Apple.

Do I need to move to a new build? or is this a Google-based issue?

Thanks.

Seth

See post immediately above (by same writer).

In the function licensingListener(), I removed the native.requestExit() call. This call was causing my app to disappear rather than “crash”.

My app is now “stable” on the Android device. But I’m clearly failing the Google Licensing confirmation step.

I originally bought my Version 1 on the Google store - and downloaded it to my own Android nexus10 tablet. It operated fine. Since then, I have uninstalled it - and loaded my newest version by simply emailing my new .apk files as attachments. In all cases, the Android device recognizes the .apk and installs it properly.

Could my problem be caused by having a live version on the Google Play store? And I’m installing an updated .apk (for testing purposes) that is NOT downloaded directly from the Google PlayStore?

I want to release this Version 2 to apple/google but cannot proceed with this Google Licensing failure showing up.

thanks for any advice/comments.

Seth

Do you need to include:

“com.android.vending.BILLING”

or whether the policy needs to be server managed or not?:

        google =
        {
            key = “KEY”,
            – This is optional, it can be strict or serverManaged(default).
            – stric WILL NOT cache the server response so if there is no network access then it will always return false.
            – serverManaged WILL cache the server response so if there is no network access it can use the cached response.
            policy = “serverManaged”,
        },

Thanks for the quick response.

I thought the server policy was defaulted to “serverManaged” so didn’t need including but I can definitely give it a try. Not sure on the com.android.vending.BILLING but will add it and see if that helps.

Cheers.

Also, what sort of errors are you getting?

The error is essentially that it’s coming back as not verified, so this section is running the alert rather than loadApp():

if (event and (not event.isError) and (not event.isVerified)) then     native.showAlert( "Licensing Failed!", "Error message here...", { "OK" } )   else     loadApp(); end

I can’t reproduce though - this is coming from a customer. They say they’re definitely connected to the web and have no problems with other apps bought from the Play Store.

Interesting! Its a little tricky to diagnose without being able to reproduce it, but you could throw up a series of dialog boxes to display the event values to determine if the error is there.

Are other users complaining of this error or just this one? Do you have a device that you can test it on?

It’s just one user. She says she’s definitely connected to the web and is having no problem with other apps. When I test the licensing using Google Play’s Beta testing functionality I can run the app fine. I can also download and run the version that’s live in the app store no problems, so the licensing seems to be working for me.

I’ll post back if I get anywhere with it. Thanks for your help to date.

I also had to remove the licensing check for some apps because I got the feedback it isn’t working correctly and I couldn’t find any changes. It has worked before but the update seems to cause problems. I have used build 2015.2744 btw.