licensing.init( "google" ) failing? (getting false back)

Yep. The code was only there in my last ditch attempt. And I’m testing on a device. Been through the tutorial and API and I can’t see what the problem is. Maybe I need to run up Wireshark or something and try to somehow put in between my device and Internet?

Actually I should be able to run the sample code, even without a real key, just to check no? Ie should get a response back still in this case?

Nope.

The key must be valid otherwise the callback isn’t called (I just checked myself).

Have you double-checked that the key in your config.lua is correct?

Mine is defined like this:

license = { google = { key = "very-long-string-on-one-line......", policy = "serverManaged" } }

key look valid.  Oh I note in terms of the uploaded APK versus what I’m now testing on (as I went through a few more iterations for what I have on the device testing), that:

 - version code (the integer) - is different (not sure why, might have been a type)

 - version name - matches

would this be an issue - would google not response because of this?  any other things need to match precisely

Version name doesn’t matter, but version code *must* be the same as on Google.

doh - ok I’ll update & retry - thanks - how did you build up this knowledge ingemar?  :)  is it documented somewhere

… how did you build up this knowledge ingemar?..

*Alot* of trial and error :slight_smile:

Sometimes I’d like to do a brain-dump, as I tend to forget things after a while :slight_smile:

just tried changes this but still no luck (I might have to go back and double-check everything to be sure), but is there anything else that comes to mind that has to match up?

  • is it just version code?

  • is it ok the app is not published

 - I did the self-signing thing when I built/build the apk using corona - can anything go astray here? 

 - support / excluded devices - I see this on Google Play - so I need to check the device I’m testing with are supported?   not too sure about this section - like if the app itself runs on the device already…

 - anything else?

PS also (just to add to my questions of desperation above) what is the concept re if users don’t have internet access when they run the app?  Do we let people play our apps if they can’t contact Google Play, or block them until they do?.. 

Anyway, licensing.init() *should* return true/false, so I’ve reported this bug to CoronaLabs.

It’s only the version code that needs to be the same and the App doesn’t need to be published.

Self-signed certificates are what I use.

Supported devices are just when you publish your apps, so you can control which devices you want to exclude/include. default is include all available devices depending on your manifest settings.

One other thing is that you need to use another Google account than your Android developer account on your device. You must set up test users in the Google Play developer console. Then you must make sure that your Android device is logged in as one of those users. Sometimes a factory reset of the device is needed to make a successful account change.

If there is no Internet connectivity, I just let them play. I know that some will exploit this, but I don’t think it’s worth pursuing to block. No matter how much effort you put in to anti-piracy some will always find a way around it. I’d rather spend my time creating new games…

Tks. So I’ve been using my dev account. Would this in itself prevent the response?

Wondering also does it have to be exactly the same build? I see a SHA hash against the version I uploaded.

You can have a different build. The main thing is that the version code is the same.

…ok… I’ve thought about another issue as well. Google Play server info lag. More info below…

What I do before testing is to create and upload an APK with the version code that I intend to use when I publish the app. Then I just leave it there during the whole testing process. It may also take several hours before that APK has propagated through Google’s system. Until then you will experience wonky behavior. Therefore I usually upload my draft APK the night before I start to do testing to ensure that all info has been propagated.

ok - perhaps that could be it, before for me it’s all been in the last say 9 hours I’d say…I’ll leave the same upload there overnight then and try again after that

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