Hi @joeversh,
We’ll check into this to see if something has changed drastically on Google’s side…
Thanks,
Brent
Hi @joeversh,
We’ll check into this to see if something has changed drastically on Google’s side…
Thanks,
Brent
Hi Brent,
More information about the debug I made.
--------- beginning of system
--------- beginning of main
V/Corona ( 9168): > Class.forName: network.LuaLoader
V/Corona ( 9168): < Class.forName: network.LuaLoader
V/Corona ( 9168): Loading via reflection: network.LuaLoader
I/Corona ( 9168): Platform: LG-D805 / ARM Neon / 5.0.2 / Adreno ™ 330 / OpenGL ES 3.0 V@84.0 AU@05.00.02.042.013 (CL@) / 2017.3068 / portugu├¬s | BR | pt_BR | pt
V/Corona ( 9168): > Class.forName: shared.google.play.services.base.LuaLoader
V/Corona ( 9168): < Class.forName: shared.google.play.services.base.LuaLoader
V/Corona ( 9168): Loading via reflection: shared.google.play.services.base.LuaLoader
V/Corona ( 9168): > Class.forName: CoronaProvider.licensing.google.LuaLoader
V/Corona ( 9168): < Class.forName: CoronaProvider.licensing.google.LuaLoader
V/Corona ( 9168): Loading via reflection: CoronaProvider.licensing.google.LuaLoader
V/Corona ( 9168): > Class.forName: plugin.texttospeech.LuaLoader
V/Corona ( 9168): < Class.forName: plugin.texttospeech.LuaLoader
V/Corona ( 9168): Loading via reflection: plugin.texttospeech.LuaLoader
V/Corona ( 9168): > Class.forName: plugin.brightness.LuaLoader
V/Corona ( 9168): < Class.forName: plugin.brightness.LuaLoader
V/Corona ( 9168): Loading via reflection: plugin.brightness.LuaLoader
V/Corona ( 9168): > Class.forName: plugin.notifications.LuaLoader
V/Corona ( 9168): < Class.forName: plugin.notifications.LuaLoader
V/Corona ( 9168): Loading via reflection: plugin.notifications.LuaLoader
I/Corona ( 9168): Verifica Original
I/Corona ( 9168): WARNING: licensing.init() was already called for google.
I/Corona ( 9168): Erro ao carregar licensingInit
I/Corona ( 9168): applicationStart
V/Corona ( 9168): > Class.forName: CoronaProvider.ads.admob.LuaLoader
V/Corona ( 9168): < Class.forName: CoronaProvider.ads.admob.LuaLoader
V/Corona ( 9168): Loading via reflection: CoronaProvider.ads.admob.LuaLoader
V/Corona ( 9168): > Class.forName: plugin.google.iap.v3.LuaLoader
V/Corona ( 9168): < Class.forName: plugin.google.iap.v3.LuaLoader
V/Corona ( 9168): Loading via reflection: plugin.google.iap.v3.LuaLoader
I/Corona ( 9168): applicationSuspend
This is my code:
function verificaOriginal() print("Verifica Original") local txt1 = "Circuito Bíblico" local txt2 = "Essa versão do aplicativo pode não ser original ou você está sem acesso à internet para poder válida-la!" local txt3 = "Repetir" local txt4 = "Aplicativo" local txt5 = "Sair" if setLanguage == 'en' then txt1 = "Bible Circuit" txt2 = "This version of the application may not be original or you may not have access to the internet to valid!" txt3 = "Repeat" txt4 = "Application" txt5 = "Exit" end local licensing = require( "licensing" ) local function licensingListener( event ) print\_r(event) if not ( event.isVerified ) then print("Não foi validado") versaoAtual.original = false saveTable(versaoAtual, "versaoApp.json") local function onComplete( event ) if ( event.action == "clicked" ) then local i = event.index if ( i == 1 ) then verificaOriginal() elseif ( i == 2 ) then abrePlayStore() GameSair() elseif ( i == 3 ) then GameSair() end else GameSair() end end local alert = native.showAlert( txt1, txt2, { txt3, txt4, txt5 }, onComplete ) else print("Validado") --versaoAtual.original = true --saveTable(versaoAtual, "versaoApp.json") --iniTelaAbertura() end end local licensingInit = licensing.init( "google" ) if ( licensingInit == true ) then print('carregado com sucesso') licensing.verify( licensingListener ) else print('Erro ao carregar licensingInit') local platform = system.getInfo('platformName') if platform ~= 'Win' and \_isPRO then versaoAtual.original = false saveTable(versaoAtual, "versaoApp.json") local function onComplete( event ) if ( event.action == "clicked" ) then local i = event.index if ( i == 1 ) then verificaOriginal() elseif ( i == 2 ) then abrePlayStore() GameSair() elseif ( i == 3 ) then GameSair() end else GameSair() end end local alert = native.showAlert( txt1, txt2, { txt3, txt4, txt5 }, onComplete ) else --versaoAtual.original = true --saveTable(versaoAtual, "versaoApp.json") --iniTelaAbertura() end end end
config.lua
application = { license = { google = { key = "Here was my license code obtained from the google play console", policy = "serverManaged" }, }, content = { scale = "adaptive", fps = 60, imageSuffix = { ["@1x"] = 1, ["@2x"] = 2, ["@3x"] = 3, }, }, }
Build.settings
settings = { plugins = { ["plugin.google.play.services"] = {publisherId = "com.coronalabs"}, ["plugin.google.iap.v3"] = {publisherId = "com.coronalabs"}, ['plugin.texttospeech'] = {publisherId = 'com.spiralcodestudio'}, ["CoronaProvider.native.popup.social"] = {publisherId = "com.coronalabs"}, ["plugin.pasteboard"] = {publisherId = "com.coronalabs"}, ["plugin.notifications"] = {publisherId = "com.coronalabs"}, ["plugin.brightness"] = {publisherId = "com.keetiz"}, }, orientation = { default ="portrait", supported = { "portraitUpsideDown", "portrait" }, }, android = { usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.WRITE\_EXTERNAL\_STORAGE", "android.permission.RECEIVE\_BOOT\_COMPLETED", "com.android.vending.CHECK\_LICENSE", "com.android.vending.BILLING", }, }, }
Thank you for your help. I await your return.
Att.,
Joéver
still can’t get this to work also!
I tried to implement the licensing like the documentation example (https://docs.coronalabs.com/api/library/licensing/) and got a bit confused with the errors, because I taked the same error than @joeversh:
WARNING: licensing.init() was already called for google.
Then I’ve tested the Licensing project from Corona SDK Samples and I noted that the documentation example is different. After a lot of tests, I created the following code to manage the licensing of my app:
License = {} License.provider = "google" -- licensing is only available for google License.store = require("store") License.gotoURL = "https://goo.gl/zYuhif" License.appName = "Your App Name" function License:licensing( event ) -- Handler that gets notified when the alert closes local function goToStore( event ) if ( event.action == "clicked" ) then system.openURL( License.gotoURL ) native.requestExit() end end if event.isVerified then print("Incredible! Someone bought my game!") else print("BANG!") local alert = native.showAlert( License.appName, "Ooops... something wrong happened... please go to Play Store, uninstall the game and download it again. Thank you!", { "OK" }, goToStore ) end end function License:initLicense() -- verify if is executing in simulator and if the store is correct if ((system.getInfo("environment") ~= "simulator") and (License.store.target == License.provider)) then License.licensingHandler = require( "licensing" ) License.licensingInit = License.licensingHandler.init( License.provider ) end end function License:verifyLicense() if ((system.getInfo("environment") ~= "simulator") and (License.store.target == License.provider)) then License.licensingHandler.verify( License ) end end
And now it´s working! B)
I hope that it help you too…
A hint:
Enter Config on left pane;
Developer Account > Account Details;
Search for License Test;
Enter the Gmail accounts that will test;
Change the type of response that these accounts will get when the function License:verifyLicense() is called.
You can see these response if you insert the following line of code in License:licensing() function:
print(event.response)
Hi @Marcelrs,
Thank you very much for the information, I will be doing a test with this code.
Hi @Brent,
I believe you need to adjust the information that is on the “https://docs.coronalabs.com/api/library/licensing/” page so that other people do not have the same problem when using the sample code that is there.
Att.,
Joéver
Hi @Joéver,
What specifically would you like me to update in the docs?
Brent
Hi @Brent,
I believe that what @Joéver want to say is that the example code given at the https://docs.coronalabs.com/api/library/licensing/ is outdated.
When we compile the example of this page, it doesn’t work.
Marcel
Thanks guys, I’ll update the docs with a better example that matches the Corona sample Licensing project.
Brent