@David
Thanks a lot ! You fixed this issue with your answer. Appreciated.
I missed to add the license key. It is now loading the plugin.
The thing is now it is crashing a little bit later (as usual: Google only. Apple goes) at the store.init call. Full crash: device blocked up. Message on device glows to terminate the not responding app etc.
Code:
in 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 InAppPurchase .lua file:
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 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", storeTransaction ) 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
The crash comes up at the store.init statement. Verified.
The above code prints in the DDMS console:
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
The app does not come from the market: it obviously comes from my adb install command of my Mac. Anything related to that ?
Any idea ?
@Rob I also recently (few days) upgraded to Basic but I am always registered here as a Starter: same comment of David. Shall I stay in trouble for that ?