by the way ingemar, re you code, are you doing an “am on on google” before entering the code you posted I guess? Like a “if device.isGoogle then” based on the device detection routine here: http://www.coronalabs.com/blog/2012/12/11/device-detection-on-steroids/ (i.e. exclude IOS, nook, kindle fire)
ps (sorry another question) - and do you have code that allows a certain amount of time before moving on and running the app if the license server doesn’t respond? Like in my case where there is no response. I see you have a check for network error, however that is only a network error as interpreted by google, and you only get this if you get an actual response back to the listener right?
No problem… ask away!
Yes, I do check if I’m on an Android device before the code I posted above is executed.
I experimented with adding a delay to allow the Google licensing to respond, but it was ugly, and I couldn’t find an acceptable solution. So, I just let the app proceed to the main menu as if everything is OK, and then just stop upon entering the listener when validation fails (that’s why you see an audio.stop() in my listener).
I get a validation response within 1-3 seconds so I’ve accepted it that way for now.
ok that makes sense - so you just have to make sure not to clean up the listener…
In fact I can NOT get google play to recognize a new version. It list my current version as “10 (0.1)” from a couple of days ago.
If I build with corona for version code 11, version name 0,2, I can upload it to Google, save it, but then when I look my app APK page it hasn’t recognized it. It still reports the current version is “10 (0.1)” from a couple of days ago?
Corona android build bug? Something I’m missing?
[my version : Version 2013.1202 (2013.8.28)]
[edit - tried with Version 2013.1203 (2013.9.11) too however still the same issue]
EDIT - Doh. Just noted there was a "versionCode = “10"” line in my build.settings. Assume this is over-riding the value you set in the Corona Android Build dialog window then(?). Still would be nice if Google warned you after uploading that it was a “bad” version that won’t take. Will retry again now without this line
After uploading the APK, Google should show a popup with the APK info. The version code in that popup is 11 right?
Also, it’s important that the APK should be saved as a Draft (in the confirmation popup click “Save Draft” *NOT* “Publish now to Production”).
It wasn’t right then. This line was near the statement about the old release being deter so I thought it was referring to the old release.
Do you set version in build.settings or just in the corona build window?
You set it only in the build window.
I hadn’t published to Google Play in a while, so I just tested with one of my apps using build 2013.1202, and there’s no problem with the APK spit out from Corona.
Make sure that you’re uploading the correct APK (triple check “Save To Folder” in the Corona build dialog!)
Maybe it’s saving the APK somewhere else. It’s happened to me before…
I need to test but my guess is my build.settings was overriding he version code and google wasn’t taking the uploads as they had the same version code…
Google will accept several Draft uploads with the same Version Code.
Now that you mention it, I remember that I think it’s possible to set version name and version code in build.settings.
I’ve never used that. It might lead to confusion since you can also set in the Corona Build dialog…
I’ll do some testing and report back
Worked! So I deleted the version line from my build.settings so it no longer overrides the corona build window dialog.
Now back to trying to get a license server response 
ingemar - when you mentioned you need to use test users (not your dev account) to test licensing, did you mean for Alpha/Beta upload testing? In my case I’m uploaded to the PROD area…
It should be in the Prod area, and the app should be uploaded as a Draft as I described earlier above.
You set up your test users under the “Settings” section of the dashboard (looks like a small gear).
Under “License testing” there is a text box where you enter your test accounts that you use on your devices (comma separated if you have more than one).
Update - now getting a response - however getting an error type of “network” back in the response. Have raised this as a separate question here, along with my test android code
http://forums.coronalabs.com/topic/39407-licensingverify-getting-an-error-type-network-back/
My code looks like this:
local onStartError = function(event) if (string.find("clicked,cancelled", event.action)) then native.requestExit(); end end local licensingListener = function(event) local verified = event.isVerified; local networkError = (event.errorType == "network"); if ((not verified) and (not networkError)) then print("ERROR: No valid licence"); audio.stop(); native.showAlert( "Error", "Sorry, no valid license found.\n".. "Please download the app again from the Google Play Store.", {"OK"}, onStartError); end end local licensing = require("licensing"); licensing.init("google"); licensing.verify(licensingListener);
Tks ingemar- my problem then is I’m not getting any response back at all to the listener. Any fault finding suggestions?
I see now that the docs say that true/false should be returned, however the sample doesn’t check that.
Try to call licensing.init(“google”) without checking the return value (or assume a true return value), and see if you get any further.
That’s what I had been doing for some time. But still never get a response back to the handler. No way to check for connection requests at the google end?
I can confirm that there’s a bug (or the docs are incorrect) as licensing.init() always return false, even on a device.
This means that the code you posted above will not work. You’ll need to remove the true/false check.
If you’ve already removed that after you posted the code above, then I’m not sure why your listener isn’t being called.
It should work. You must run it on a device though. Corona simulator will not work.