Hello all,
I have a problem with the store.init statement that crashes my app. The V3 plugin seems to be correctly loaded.
CODE:
main.lua
if (device.isAndroid) then print("DEVICE=Android") local licensing = require( "licensing" ) licensing.init( "google" ) local function licensingListener( event ) local verified = event.isVerified print( "address", event.address ) print("name", event.name) print("provider", event.provider) print("isVerified", event.isVerified) print("isError", event.isError) print("errorType", event.errorType) print("response", event.response) if not event.isVerified then --failed verify app from the play store, we print a message print( "Binary NOT BEING VERIFIED from the Google App Store !" ) --native.requestExit() --assuming this is how we handle pirates else print( "Google app has been verified" ) end end licensing.verify( licensingListener ) end
In the iap.lua :
if ( device.isAndroid ) then store = require( "plugin.google.iap.v3" ) v3 = true message="Google store plugin loaded" elseif ( device.isApple ) then message="Apple store library loaded" store = require( "store" ) end if (store ~= nil) then print ("STORE loaded: ".. message) else print ("STORE NOT loaded: ".. message) end
if (store~=nil) then --utilize 'store.availableStores' function: if device.isApple then -- and store.availableStores.apple then currentProductList = appleProductList store.init( "apple", storeTransaction ) --elseif ( v3 == true or store.availableStores.google ) then elseif ( v3 == true ) then currentProductList = googleProductList store.init( "google", onGoogleInAppBilling ) print ("Google store initialized") else local message= "In-app purchases are not supported on this system/device." native.showAlert( system.getInfo("appName"), message , { "Ok"},exitFromIap ) end end if device.isApple and ( not store.canMakePurchases) then message=translations.localize("warnpurchasenotenabled", "language") native.showAlert( system.getInfo("appName"), message , { "Ok"},exitFromIap ) end
The crash comes up at the store.init( “google”, onGoogleInAppBilling ) statement. Verified. Removing just that line the app shows the scene and does not crash.
The code shows a DDMS console output like this:
10-10 18:38:30.859: V/Corona(21662): > Class.forName: CoronaProvider.gameNetwork.google.LuaLoader
10-10 18:38:30.859: V/Corona(21662): < Class.forName: CoronaProvider.gameNetwork.google.LuaLoader
10-10 18:38:30.859: V/Corona(21662): Loading via reflection: CoronaProvider.gameNetwork.google.LuaLoader
10-10 18:38:35.656: I/Corona(21662): address nil
10-10 18:38:35.656: I/Corona(21662): name licensing
10-10 18:38:35.656: I/Corona(21662): provider google
10-10 18:38:35.656: I/Corona(21662): isVerified false
10-10 18:38:35.656: I/Corona(21662): isError true
10-10 18:38:35.656: I/Corona(21662): errorType configuration
10-10 18:38:35.656: I/Corona(21662): response Not market managed
10-10 18:38:35.656: I/Corona(21662): Binary NOT BEING VERIFIED from the Google App Store !
10-10 18:38:44.757: V/Corona(21662): > Class.forName: plugin.google.iap.v3.LuaLoader
10-10 18:38:44.765: V/Corona(21662): < Class.forName: plugin.google.iap.v3.LuaLoader
10-10 18:38:44.765: V/Corona(21662): Loading via reflection: plugin.google.iap.v3.LuaLoader
10-10 18:38:44.773: I/Corona(21662): STORE loaded: Google store plugin loaded
and here the app crashes with os message after a while telling me the app is not responding etc…
Note: the licensing plugin returns isVerified==false as the app is still draft in Google Dev and has been loaded into the physical device using adb install on my Mac.
BTW: built using Corona public release 2393
Any idea ?
Thank you for any help
Stefano