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’ve just tried to use the plugin today, and it fails when trying to call ouyaSetDeveloperId()
Even just this small bit of code at the start of main.lua is enough to cause a problem:
ouyaSDK = require("plugin.ouya") ouyaSDK.ouyaSetDeveloperId("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") --with my correct ID obviously local function onOuyaReceiptSuccess(jsonData) print("ouya product request successful") end local function onOuyaReceiptFail(errorCode, errorMessage) print("ouya product request failed") end local function onOuyaReceiptCancel() print("ouya product request cancelled") end ouyaSDK.asyncLuaOuyaRequestReceipts(onOuyaReceiptSuccess, onOuyaReceiptFail, onOuyaReceiptCancel)
I get the following error:
Runtime error 08-07 14:32:14.418: I/Corona(2885): ?:0: attempt to call field 'ouyaSetDeveloperId' (a nil value) 08-07 14:32:14.418: I/Corona(2885): stack traceback: 08-07 14:32:14.418: I/Corona(2885): ?: in function 'ouyaSetDeveloperId' 08-07 14:32:14.418: I/Corona(2885): ?: in function 'initialize' 08-07 14:32:14.418: I/Corona(2885): ?: in function 'asyncLuaOuyaRequestReceipts' 08-07 14:32:14.418: I/Corona(2885): ?: in main chunk
Although my code above hasn’t used the plugin_ouya.lua class (I’ve just called the functions directly), I did also try with that and had the same error.
I’m on the latest Corona build (2393), so has something in the plugin changed which could be causing a problem?
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’ve just tried to use the plugin today, and it fails when trying to call ouyaSetDeveloperId()
Even just this small bit of code at the start of main.lua is enough to cause a problem:
ouyaSDK = require("plugin.ouya") ouyaSDK.ouyaSetDeveloperId("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") --with my correct ID obviously local function onOuyaReceiptSuccess(jsonData) print("ouya product request successful") end local function onOuyaReceiptFail(errorCode, errorMessage) print("ouya product request failed") end local function onOuyaReceiptCancel() print("ouya product request cancelled") end ouyaSDK.asyncLuaOuyaRequestReceipts(onOuyaReceiptSuccess, onOuyaReceiptFail, onOuyaReceiptCancel)
I get the following error:
Runtime error 08-07 14:32:14.418: I/Corona(2885): ?:0: attempt to call field 'ouyaSetDeveloperId' (a nil value) 08-07 14:32:14.418: I/Corona(2885): stack traceback: 08-07 14:32:14.418: I/Corona(2885): ?: in function 'ouyaSetDeveloperId' 08-07 14:32:14.418: I/Corona(2885): ?: in function 'initialize' 08-07 14:32:14.418: I/Corona(2885): ?: in function 'asyncLuaOuyaRequestReceipts' 08-07 14:32:14.418: I/Corona(2885): ?: in main chunk
Although my code above hasn’t used the plugin_ouya.lua class (I’ve just called the functions directly), I did also try with that and had the same error.
I’m on the latest Corona build (2393), so has something in the plugin changed which could be causing a problem?
The problem back then was that I published the plugin changes under a newer version of Corona and so the plugin wasn’t loaded. Since then I downgraded the plugin version which should fix the issue.
I’ve made an update to the way the Corona OUYA Plugin initializes. Now you’ll get an onSuccess or onFailure callback.
Here’s the main.lua and how the plugin is being initialized:
The problem back then was that I published the plugin changes under a newer version of Corona and so the plugin wasn’t loaded. Since then I downgraded the plugin version which should fix the issue.
I’ve made an update to the way the Corona OUYA Plugin initializes. Now you’ll get an onSuccess or onFailure callback.
Here’s the main.lua and how the plugin is being initialized: