The in-app-purchase logic is only going to work on the OUYA. It won’t work in the simulator.
IIRC I just print that the platform is not supported. Are you saying that your simulator is crashing?
The in-app-purchase logic is only going to work on the OUYA. It won’t work in the simulator.
IIRC I just print that the platform is not supported. Are you saying that your simulator is crashing?
Hi Tim,
Thanks for your reply - unfortunately it looks like the OUYA servers are down right now so I’m unable to test further for the time being. I’ll report back - thank you again for the help - the problem I’m experiencing now is just no response when I try to request a purchase. I’m not sure if I’m connecting to OUYA’s IAP system at all. I’ll report back in a bit -
Now that the OUYA servers are back I’m still stuck… just no response when I try to request a purchase. I’m wondering if it’s because version 1.0 of my app says there are no in app purchases in the OUYA dev interface whereas this new version I am building does have in app purchases.
You should have created a package in the developer portal. Your game has to match that package id. It’s case sensitive. You need to download the signing key for your game in the developer portal. Grab the UUID for your developer from the developer portal. Create a product id in the developer portal. All these things must match in your application.
Thanks Tim. I wish I could say I’ve missed something, but I’ve triple-checked and everything seems as it should be. My developer ID is set in plugin_ouya.lua, my package name matches that in the ouya dev portal, key.der is is in my project folder, and lastly, my product identifier matches that in my request purchase call. It should be sent as a string, right?
I’m wondering if I’m doing something stupid… one must call plugin_ouya.initialize(); first, correct?
Does one have to request a list of products before one can request a purchase?
Apologies for the multiple posts, but I’ve gained new information - using adb logcat on the OUYA I see that an error is being thrown as ‘plugin_ouya’ isn’t being recognized at all…
“attempt to index global ‘plugin_ouya’ (a nil value)”
This is despite logcat appearing to show a successful init…
I/PluginOuyaLuaLoader(15328): invoke I/PluginOuyaLuaLoader(15328): Register named functions for lua I/PluginOuyaLuaLoader(15328): Initializing OUYA... I/PluginOuyaLuaLoader(15328): Get application context... I/PluginOuyaLuaLoader(15328): Load signing key... I/PluginOuyaLuaLoader(15328): \*\*\*Loaded signing key\*\*\*\*\*\*\*\*\* I/PluginOuyaLuaLoader(15328): Initialize controller... I/PluginOuyaLuaLoader(15328): Initialize CoronaOuyaPlugin... I/PluginOuyaLuaLoader(15328): Get activity from context... I/PluginOuyaLuaLoader(15328): Spawn wait thread... I/PluginOuyaLuaLoader(15328): Named functions for lua registered. I/PluginOuyaLuaLoader(15328): \*\*\*\* I/PluginOuyaLuaLoader(15328): \*\*\*\*\* I/PluginOuyaLuaLoader(15328): \*\*\*\* I/PluginOuyaLuaLoader(15328): \*\*\*\* I/PluginOuyaLuaLoader(15328): \*\*\*\*
Anyone know why this might be?
You don’t need to get the product details before requesting a purchase.
It’s been a while since I looked last and definitely need to make some updates.
Do you have Corona Pro?
There’s a couple ways to load the plugin and I made sure that I could compile it on Windows and Mac.
https://github.com/ouya/docs/blob/master/corona.md
Okay it looks like the way I wrote it, Corona Pro is needed to use the plugin.
And Corona Enterpise is needed if you want to customize the Java to do a traditional Android app with Corona.
More docs on the plugin:
http://docs.coronalabs.com/daily/plugin/ouya/
If you follow these steps it should work in:
Availability Basic, Pro, Enterprise
Hey Tim,
Thanks again for your continued help. Those directions were the ones I was following but still no dice
Somehow I was able to get the calls to work (!) by calling the ouyaSDK methods directly (and not using plugin_ouya). So, all’s well that ends well. Thanks again for your persistence - my app is now pending review by OUYA
Nick
I have a question for any devs that have had success with IAP on OUYA. I’ve completed all the steps on the IAP purchase and unlock on the app but when the OUYA purchase dialog closes I get a runtime error and it dumps me out of the scene I’m in and back to my title screen.
In the android log I can see that my purchase OnSuccess callback has run correctly and the game has been unlocked but then I get the following error. ( I’ve included some additional lines before the error for context )
I/PluginOuyaLuaLoader( 1996): CoronaRuntimeEventHandler.onResumed W/InputMethodManagerService( 327): Ignoring showSoftInput of uid 10029: com.android.internal.view.IInputMethodClient$Stub$Proxy@42144510 I/MetricsReceiver( 547): Action: tv.ouya.metrics.action.LIFECYCLE\_EVENT I/MetricsReceiver( 547): Activity: STOP I/MetricsReceiver( 547): Updating app sessions... I/MetricsReceiver( 547): Updating app session: com.ansca.corona.CoronaActivity [803d1cbc-54e0-47f8-97ed-80916e848eb1] I/MetricsReceiver( 547): Updating app session: tv.ouya.console.launcher.store.DetailsActivity [a197c07a-80e0-4d7c-acd9-ce10ebf25382] I/MetricsReceiver( 547): Cancelling previous update I/MetricsReceiver( 547): Scheduling next periodic update at: 1404408933112 I/Corona ( 1996): Runtime error I/Corona ( 1996): ?:0: attempt to index field '?' (a nil value) I/Corona ( 1996): stack traceback: I/Corona ( 1996): [C]: ? I/Corona ( 1996): ?: in function '\_listener' I/Corona ( 1996): ?: in function \<?:141\> I/Corona ( 1996): ?: in function \<?:218\>
Has anyone seen something like this before? Does the ouyaSDK.asyncLuaOuyaRequestPurchase return anything outside of the based callback functions? I’m not sure where to look to solve this problem.
I plan on updating the Corona plugin around August to the latest.
This would include getting access to the gamer info, username, controller button images, along with OUYA-Everywhere support.
I can’t see anything obvious from the stack trace.
bpollet, what is in your OnSuccess callback, if anything?
Thank you both for responding, I’m getting tired of banging my head into the wall alone.
This is what’s in my purchase OnSuccess callback: I’m reading all the print statements in the log file along with the purchase identifier that I’m expecting but then after that it crashes out of the scene.
callbacksRequestPurchase.onSuccess = function (jsonData) if jsonData == nil then print("onSuccessRequestPurchase: (nil)"); elseif jsonData == "" then print("onSuccessRequestPurchase: (empty)"); else print("onSuccessRequestPurchase: jsonData=" .. jsonData); local purchase = json.decode(jsonData); print("You purchased product with ID: " .. purchase["identifier"]) M.unlocked = true print("Set M.unlocked to true") M:writeUnlockToFile() print("Wrote unlock to file") end end
I’m using an older version of Corona ( Build 2013.1260 ) because my game isn’t Graphics 2.0 compatible. Any chance that would impact the interaction with the OUYA plugin?
I won’t expect the GLES level to affect the OUYA-plugin…
I’m having a bear of a time with this… I still can’t get the ‘in app purchase’ dialog box to show up. I have my developer key set, I’m using the same bundle name defined in the OUYA interface for the apk, I’m calling plugin_ouya.initialize() when my game loads and calling plugin_ouya.asyncLuaOuyaRequestPurchase(callbacksRequestPurchase.onSuccess, callbacksRequestPurchase.onFailure, callbacksRequestPurchase.onCancel, “donate_justrain”); when a button is pressed… yet still, nothing. I should note that my mac simulator crashes because it can’t find plugin_ouya because the plugin is not supported on OSX, so I have no way to test if the plugin is being loaded, initialized, or anything. Can anyone help?
I’m kind of confused as to which files of the plugin have to be included alongside my main.lua file. plugin_ouya.lua I guess, but do the callback lua scripts and the helper scripts, etc., also have to be included?
Thanks for any guidance -
The in-app-purchase logic is only going to work on the OUYA. It won’t work in the simulator.
IIRC I just print that the platform is not supported. Are you saying that your simulator is crashing?
Hi Tim,
Thanks for your reply - unfortunately it looks like the OUYA servers are down right now so I’m unable to test further for the time being. I’ll report back - thank you again for the help - the problem I’m experiencing now is just no response when I try to request a purchase. I’m not sure if I’m connecting to OUYA’s IAP system at all. I’ll report back in a bit -
Now that the OUYA servers are back I’m still stuck… just no response when I try to request a purchase. I’m wondering if it’s because version 1.0 of my app says there are no in app purchases in the OUYA dev interface whereas this new version I am building does have in app purchases.