Hi,
I have some problems integrating a simple remove ads IAP in my app.
I have done it successfully for iOS but It seems like there is something wrong with the Android version.
I must point out that my app was based on a very well done template which try to cover both platform (iOS and Android), so some coding could seem a bit strange.
I have my app in Beta testing and I am testing on a device with a different gmail account than the developer one. (this account is in the list of tester in Google Play for my app).
The app is published and the iAP is active.
When I press the button for removing the ads I get the message: Error: The purchase has failed
This is the log:
I/Finsky (19195): [11509] com.google.android.finsky.billing.iab.o.a(5172): com.companyname.appname: Account determined from installer data - [bxd\_L8mlDhJaWLfdYNdSTFaBzf8] W/Finsky (19195): [11509] com.google.android.finsky.billing.iab.b.a(458): Input Error: Non empty/null argument expected for sku. E/IabHelper(14044): In-app billing error: Unable to buy item, Error response: 5:Developer Error I/Keyboard.Facilitator( 995): onFinishInput() I/Keyboard.Facilitator( 995): onFinishInput()
My build settings seems to be in order:
settings = { ["plugin.google.iap.v3"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, android = { usesPermissions = { "com.android.vending.BILLING", }, }, }
Key is in my config.lua file
This is the function on touchEnded of the Remove Ads button which work perfectly for iOS (
function removeAdsButton:touchEnded() audio.play(buttonSFX, {channel = audio.findFreeChannel()}); self:setFillColor(1, 1, 1); self.xScale, self.yScale = 1, 1; iApLib.purchaseItem(\_G.iApItems["removeAds"], function(result)
Now the [“removeAds”] item is specified in my setupfile.lua
\_G.iApItems = { ["removeAds"] = {"iAP ID here"}, };
And finally this the code related to store.init and store.purchase in my iAP Library:
iApLib.purchaseItem = function(item, callback) resultFun = callback; if store.canMakePurchases then native.setActivityIndicator(true); if system.getInfo("platformName") == "Android" then store.purchase(item[1]); else store.purchase(item); end else native.showAlert("Error", "Purchases are not supported on this device.", {"Ok"}); end end if system.getInfo("platformName") == "Android" then store = require( "plugin.google.iap.v3" ) store.init("google", iApListener); else store = require "store"; store.init("apple", iApListener); end
Now I tried to place my iAp ID from Google (com.companyname.appname.etc) instead of the Apple one in the setup file, both like
{"iAP ID here"}
and
("iAP ID here")
but I have the same error.
Thanks so much