That is partly why spill shared this, I believe.raidho36 wrote:Maybe this can be implemented as core functionality instead, given that it's a fairly standard feature for mobile apps.

That is partly why spill shared this, I believe.raidho36 wrote:Maybe this can be implemented as core functionality instead, given that it's a fairly standard feature for mobile apps.
That's what I'm currently working on. Right now, I'm trying to figure out how to add the appropriate billing helper module and wrap my head around the Android dev environment. Based on the iOS experience, it should take a couple of weeks to get it finished. In my ideal world, purchasing would be built into löve by default, and hopefully this work will lead to that, or at least help anyone else who wants to do IAP in the meantime.raidho36 wrote:Now to implement something similar for Android... Given enough effort that could show up in the next minor version.
I'd prefer suspending the lua code execution on the API call and returning the result of the purchase once it's finished (like love.window.showMessageBox() does) instead of having an SDL event because it makes the code a lot cleaner, as you can see here:bartbes wrote:Love's event queue is thread-safe, and you don't have to predeclare events either, that might be a good option.
Code: Select all
function button:onPressed()
if love.system.makePurchase("foo.baz.item1") == "success" then
ITEM1_UNLOCKED = true
end
end
Code: Select all
function button:onPressed()
pauseGame()
love.system.makePurchase("foo.baz.item1")
end
local dispatchTable = {
["foo.baz.item1"]=function(status)
unpauseGame()
if status == "success" then
ITEM1_UNLOCKED = true
end
end,
}
function love.purchased(purchaseID, status)
if dispatchTable[purchaseID] then dispatchTable[purchaseID](status) end
end
raidho36 wrote:On the flipsede it freezes the game for the whole duration, which may be a lot, especially if it has to timeout - up to 2 minutes. Freezing the app alone creates poor user experience since it becomes unresponsive and there is no progress indication, and sophisticated OS can detect it as hang (because that's what it is) and suggest kill the app or even do it automatically.
IAPs are fundamentally networking activity and you never do synchronous networking, period.
zorg wrote:Okay, but one could just not use the modal messagebox function, and just implement a visual one with löve itself, that way it may not block. (i.e. not freeze the whole game)
¯\_(ツ)_/¯Spill wrote:Actually no, Apple doesn't let you do that. Presumably in order to prevent apps from making deceptive or confusing purchase dialogs (or stealing the user's credentials, maybe?), the only way to make a purchase through Apple involves using their native purchase modal dialog. There's no way to request a purchase without popping one up. It also fills in the region/currency-specific pricing, which is something you wouldn't want to do by hand.
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 2 guests