Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
IAB - what is difference between iOS and Android? — Gideros Forum

IAB - what is difference between iOS and Android?

unlyingunlying Guru
edited July 2015 in General questions
I'm trying to use exactly same code that works on Android for iOS(except not using iab:setUp), but it doesn't work for me.
Here is the code:
require "iab"

iab = IAB.new("iOS")

iab:setProducts({p1 = "guessanimal", p2 = "200ss"})
iab:setConsumables({"p1", "p2"})


iab:addEventListener(Event.AVAILABLE, function(e)
--
iab:addEventListener(Event.PRODUCTS_COMPLETE, function(e)
for i = 1, #e.products do
local p = e.products[i]
print(p.productId, p.title, p.description, p.price)
end
end)
iab:addEventListener(Event.PRODUCTS_ERROR, function(e)
print(e:getType(), e.error)
end)
iab:requestProducts()
iab:addEventListener(Event.PURCHASE_ERROR, function(e)
print(e:getType(), e.error)
end)


iab:addEventListener(Event.PURCHASE_COMPLETE, function(e)
if (e.productId == "p1") then
coins=coins+100
dataSaver.saveValue("coins", coins)
local alertDialog = AlertDialog.new("You have that much coins now :)", coins, "OK")
alertDialog:show()
end
if (e.productId == "p2") then
coins=coins+200
dataSaver.saveValue("coins", coins)
local alertDialog = AlertDialog.new("You have that much coins now :)", coins, "OK")
alertDialog:show()
end
end)
end)
--
iab:isAvailable()
Sign In or Register to comment.