It looks like you're new here. If you want to get involved, click one of these buttons!
if application:getDeviceInfo() == "Android" then require "iab" IAB_GOOGLE=IAB.new("google") IAB_GOOGLE:setUp("VERY_LONG_API_KEY_FROM_GOOGLEPLAY_CONSOLE") IAB_GOOGLE:setProducts({remove_ads = "remove_ads"}) IAB_GOOGLE:isAvailable() IAB_GOOGLE:addEventListener(Event.AVAILABLE, function(event) print("Event.AVAILABLE") IAB_GOOGLE:requestProducts() end) --trying to add these two events result in lua error: IAB_GOOGLE:addEventListener(Event.PRODUCT_COMPLETE, function(event) print("Event.PRODUCT_COMPLETE:", event.productId, event.title, event.description, event.price) end) IAB_GOOGLE:addEventListener(Event.PRODUCT_ERROR, function(event) print("Event.PRODUCT_ERROR:", event.error) end) --init.lua:213: bad argument #1 to 'addEventListener' (string expected, got nil) --stack traceback: -- init.lua:213: in main chunk IAB_GOOGLE:addEventListener(Event.PURCHASE_COMPLETE, function(event) print("Event.PURCHASE_COMPLETE", event.productId, event.receiptId) --User successfully purchased "no_ads", now I gotta reward him: SETTINGS.adsAllowed=false; SETTINGS.interstitialAllowed=false IAB_GOOGLE:confirm(event.productId) --what does it do? end) IAB_GOOGLE:addEventListener(Event.PURCHASE_ERROR, function(event) print("Event.PURCHASE_ERROR:", event.error) end) end --after "NoAds" button pushed, I'll have to call: --IAB_GOOGLE:purchase("remove_ads") |
Comments
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Likes: MoKaLux, oleg, plicatibu
https://deluxepixel.com
@SinisterSoft I've replaced old example with your code
Thanks a lot, guys!
P. s. For some reason this stuff is not printed:<pre class="CodeBlock">
Likes: MoKaLux, plicatibu, SinisterSoft
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
Likes: Apollo14
https://deluxepixel.com