Android IAP - use with Director

Hi all,

I’ve been trying to integrate the sample code for in app purchases.

The sample as is works fine, however i seem to be having compatibility issues with the version of Director i am using (1.2).

I have set the sample code up in as basic a fashion as possible. I simply use director to change from my menu scene to my app purchasing options. In Corona this works fine, but running the terminal or running on a device will bring up an error

director.lua:270: attempt to index a boolean value

Is there any workaround i can use to get this working? Switching my version of Director is not an option.

Thank you [import]uid: 125592 topic_id: 30200 reply_id: 330200[/import]

Hi,
I using the InAppPurchase sample code with director. I tried to wrap the iap code inside a function new() but got the same error that u got. The change i made was creating the function new() that director requires in the end, outside the sample code, and call the setupMyStore function from there instead of the timer that the sample code uses.
Works perfect on both android and ios.
But im using the latest director and build 840. So maybe the issues is to 1.2
Check out this thread to see my code. http://developer.coronalabs.com/forum/2012/08/22/app-purchase-ios.

But in a nutshell something like this:
[lua]require (“store”)
–Rest of the IAP Sample Code
local function setupMyStore()

function new()
local gui = display.newGroup()
setupMyStore()
return gui
end[/lua]

[import]uid: 126729 topic_id: 30200 reply_id: 120991[/import]

Hi, thanks for this - I am looking forward to giving this a try later, I’m hoping it is compatible with the version of director I’m using.

I’ll post back later with an update! [import]uid: 125592 topic_id: 30200 reply_id: 120992[/import]

Wow, works great, thank you!

Only thing to mention is that i also needed to add:

module(…, package.seeall)

to the top of the sample code.

Thanks again [import]uid: 125592 topic_id: 30200 reply_id: 121067[/import]

Hi, out of curiosity, how are you removing the item buttons when you change scene? I am not having any luck with this?

Thanks [import]uid: 125592 topic_id: 30200 reply_id: 121281[/import]

Hi,
I using the InAppPurchase sample code with director. I tried to wrap the iap code inside a function new() but got the same error that u got. The change i made was creating the function new() that director requires in the end, outside the sample code, and call the setupMyStore function from there instead of the timer that the sample code uses.
Works perfect on both android and ios.
But im using the latest director and build 840. So maybe the issues is to 1.2
Check out this thread to see my code. http://developer.coronalabs.com/forum/2012/08/22/app-purchase-ios.

But in a nutshell something like this:
[lua]require (“store”)
–Rest of the IAP Sample Code
local function setupMyStore()

function new()
local gui = display.newGroup()
setupMyStore()
return gui
end[/lua]

[import]uid: 126729 topic_id: 30200 reply_id: 120991[/import]

Hi, thanks for this - I am looking forward to giving this a try later, I’m hoping it is compatible with the version of director I’m using.

I’ll post back later with an update! [import]uid: 125592 topic_id: 30200 reply_id: 120992[/import]

Wow, works great, thank you!

Only thing to mention is that i also needed to add:

module(…, package.seeall)

to the top of the sample code.

Thanks again [import]uid: 125592 topic_id: 30200 reply_id: 121067[/import]

Hi, out of curiosity, how are you removing the item buttons when you change scene? I am not having any luck with this?

Thanks [import]uid: 125592 topic_id: 30200 reply_id: 121281[/import]