Google play and loadProducts()

Hi all,

I’ve have just purchased Corona and am at the point where I am ready to integrate IAP with my Android game. Because I am allowing my game to be downloaded and played in more than just my home country I need to be able to download the IAPs in local currency which loadProducts() seems to provide.  I cannot, however, seem to get this to function against Google Play using an Android device to test.

I see from another post that this might not yet be supported - I am using 2013.2100.  Can you provide a timescale for a public release that will support this?  Or please provide any assistance for achieving this with my current build.  This is the last thing I need to integrate before publishing my app.

Also, is there anyway of testing IAPs within the simulator or is it only install to device and multiple print() statements?

Regards

Adrian

Google IAP V3 will be released as a plugin, so it won’t be tied to a public release.  It’s in a private beta at the moment, so hopefully we will open this up soon.

As far as testing, you have to test on device because your PC or Mac does not  have the Google Play app installed, and the IAP code depends on the Google Play app.

Rob

HI Rob and thanks for the response.  Will we get notified when the plugin is available?  Also I am having a weird problem with some code… I have this function which works fine in the simulator

function IAP:buyExtraLives(callbackFunction) print("IAP:buyExtraLives") if system.getInfo("environment") == "simulator" then callbackFunction("yes") else print("About to buy from store") native.setActivityIndicator(true) print("do purchase") store.purchase( "extra\_moves" ) callback = callbackFunction end end

but not on device.  the calling code is

function overlayBuy\_buyButtonEvent( event ) if event.phase == "release" then if IAP:isConnected() == true then print ("IAP connected") if buyWhat == "extraMoves" then print("buy = "..buyWhat) IAP:buyExtraMoves(overlayBuy\_CallBack) elseif buyWhat == "levelSkip" then print("buy = "..buyWhat) IAP:buyLevelSkip(overlayBuy\_CallBack) elseif buyWhat == "extraLives" then print("buy = "..buyWhat) IAP:buyExtraLives(overlayBuy\_CallBack) end else print ("IAP not connected") popupResult = "buyClose" storyboard.hideOverlay({time=200, effect="zoomInOutFade"}) end return true end end function overlayBuy\_CallBack( purchased ) if purchased == "yes" then print("transcation passed") popupResult = buyWhat storyboard.hideOverlay({time=200, effect="zoomInOutFade"}) else print("transcation failed/cancelled") end end

In the simulator I get “transaction passed” printed in the console but on a device I get “?:0: attempt to index upvalue ‘?’ (a nil value)”.  The very last prints are “IAP Connected” and then “buy = extraMoves” but I never get “About to buy from store”.  Any ideas as I can’t figure it out.

Thanks

Adrian

We will probably announce it on the blog and in the weekly newsletter.

You might want to move the overlayBuy_Callback above where you are calling it.

Rob

Google IAP V3 will be released as a plugin, so it won’t be tied to a public release.  It’s in a private beta at the moment, so hopefully we will open this up soon.

As far as testing, you have to test on device because your PC or Mac does not  have the Google Play app installed, and the IAP code depends on the Google Play app.

Rob

HI Rob and thanks for the response.  Will we get notified when the plugin is available?  Also I am having a weird problem with some code… I have this function which works fine in the simulator

function IAP:buyExtraLives(callbackFunction) print("IAP:buyExtraLives") if system.getInfo("environment") == "simulator" then callbackFunction("yes") else print("About to buy from store") native.setActivityIndicator(true) print("do purchase") store.purchase( "extra\_moves" ) callback = callbackFunction end end

but not on device.  the calling code is

function overlayBuy\_buyButtonEvent( event ) if event.phase == "release" then if IAP:isConnected() == true then print ("IAP connected") if buyWhat == "extraMoves" then print("buy = "..buyWhat) IAP:buyExtraMoves(overlayBuy\_CallBack) elseif buyWhat == "levelSkip" then print("buy = "..buyWhat) IAP:buyLevelSkip(overlayBuy\_CallBack) elseif buyWhat == "extraLives" then print("buy = "..buyWhat) IAP:buyExtraLives(overlayBuy\_CallBack) end else print ("IAP not connected") popupResult = "buyClose" storyboard.hideOverlay({time=200, effect="zoomInOutFade"}) end return true end end function overlayBuy\_CallBack( purchased ) if purchased == "yes" then print("transcation passed") popupResult = buyWhat storyboard.hideOverlay({time=200, effect="zoomInOutFade"}) else print("transcation failed/cancelled") end end

In the simulator I get “transaction passed” printed in the console but on a device I get “?:0: attempt to index upvalue ‘?’ (a nil value)”.  The very last prints are “IAP Connected” and then “buy = extraMoves” but I never get “About to buy from store”.  Any ideas as I can’t figure it out.

Thanks

Adrian

We will probably announce it on the blog and in the weekly newsletter.

You might want to move the overlayBuy_Callback above where you are calling it.

Rob