OUYA Documentation, Videos, and Examples

I recently added an OUYA plugin for Corona PRO users which enables in-app-purchases. You can build and publish from Mac and Windows.

https://devs.ouya.tv/developers/docs/corona

Here you’ll find videos, examples, and documentation.

General Steps

The general steps for in-app-purchases are:

Check player prefs to see if the full game has been unlocked.

If the game hasn’t been unlocked, check receipts for the purchase.

If the purchase is found, set the player prefs that the game is unlocked.

If the purchase is not found, show the store/buy button.

When the buy button is pressed, request a purchase.

Upon successful purchase set the player prefs for full game unlocked.

If the player prefs has full game unlocked, show a visual change that the game is unlocked.

I am getting this when trying to prepare a build of the sample on a Mac with Corona Pro:

2013-09-06 14:33:23.425 Corona Simulator[37482:707] Copyright (C) 2009-2013 C o r o n a L a b s I n c . 2013-09-06 14:33:23.426 Corona Simulator[37482:707] Version: 2.0.0 2013-09-06 14:33:23.426 Corona Simulator[37482:707] Build: 2013.1202 2013-09-06 14:33:23.428 Corona Simulator[37482:707] The file sandbox for this project is located at the following folder: (/Users/tonygod/Library/Application Support/Corona Simulator/OuyaCoronaPlugin-D85458E18E8025AB7924AA842FE23919) 2013-09-06 14:33:24.210 Corona Simulator[37482:707] PluginSync: downloading plugin: http://plugins.coronasphere.com/tv.ouya/plugin.ouya/2013.1202/mac-sim/plugin.ouya.zip 2013-09-06 14:33:24.368 Corona Simulator[37482:707] plugin.ouya is not supported on this platform

Any advice?

Oh you just see that when opening on the Mac in the simulator. It actually has to run on the OUYA to execute the Java code to invoke IAP.

You should be able to open the main.lua here in the simulator and build for android.

https://github.com/ouya/ouya-sdk-examples/tree/master/Corona/Submission/ouya/samples/InAppPurchasesPlugin/Corona

And then run:

adb install -r the.apk

Ok, thanks.  That makes sense.  Next build problem I am having is this.  I have not seen this one before.

2013-09-06 15:09:04.077 Corona Simulator[37556:707] Copyright (C) 2009-2013 C o r o n a L a b s I n c . 2013-09-06 15:09:04.078 Corona Simulator[37556:707] Version: 2.0.0 2013-09-06 15:09:04.078 Corona Simulator[37556:707] Build: 2013.1202 2013-09-06 15:09:04.083 Corona Simulator[37556:707] The file sandbox for this project is located at the following folder: (/Users/tonygod/Library/Application Support/Corona Simulator/OuyaCoronaPlugin-D85458E18E8025AB7924AA842FE23919) 2013-09-06 15:09:04.626 Corona Simulator[37556:707] plugin.ouya is not supported on this platform 2013-09-06 15:09:29.329 Corona Simulator[37556:707] Using Custom Build Id 72436d308ba9c37eb8ddd77791fb8968 2013-09-06 15:09:49.064 Corona Simulator[37556:707] Connection error: (corona.get) fault(/CFStreamFault) 2013-09-06 15:09:49.064 Corona Simulator[37556:707] Connection error: (corona.get) ({ "/FaultCode" = "-65794"; "/FaultExtra" = { domain = 1; error = 57; msg = "Stream Error"; }; "/FaultString" = "/CFStreamFault"; "/kWSResultIsFault" = 1; }) 2013-09-06 15:09:49.065 Corona Simulator[37556:707] ERROR: Unexpected empty response from build server 2013-09-06 15:09:49.268 Corona Simulator[37556:707] Connection error: (user.logout) fault(/CFStreamFault) 2013-09-06 15:09:49.268 Corona Simulator[37556:707] Connection error: (user.logout) ({ "/FaultCode" = "-65794"; "/FaultExtra" = { domain = 1; error = 57; msg = "Stream Error"; }; "/FaultString" = "/CFStreamFault"; "/kWSResultIsFault" = 1; }) 

Never mind!  It seemed to be an intermittent network issue that is gone now and I got it to build and deploy on my Ouya!

Now on the OUYA dev portal you’ll register a game and enter a package/bundle identifier. Then download the signing key (key.der) and put it into your Corona folder. Set your developer UUID in

https://github.com/ouya/ouya-sdk-examples/blob/master/Corona/Submission/ouya/samples/InAppPurchasesPlugin/Corona/plugin_ouya.lua

plugin_ouya.developerId = “310a8f51-4d6e-4ae5-bda0-b93878e5f5d0”;

And if it all matches, you’ll be in business.

You’ll create an entitlement/consumable for purchase and you’ll see how it’s invoked in the inputs.lua script.

https://github.com/ouya/ouya-sdk-examples/blob/master/Corona/Submission/ouya/samples/InAppPurchasesPlugin/Corona/inputs.lua

Request a purchase using the “purchasbale” id that you create in the developer portal.

plugin_ouya.asyncLuaOuyaRequestPurchase(callbacksRequestPurchase.onSuccess, callbacksRequestPurchase.onFailure, callbacksRequestPurchase.onCancel, purchasable);

And you should see the in-app-purchase dialog.

Thanks, that extra bit got me into my own products and I have it all working with a modified sample.  It is so great to have this Corona/OUYA integration at this point!

Where do I download the correct signing key from?  I am trying to test completing the purchase today and it always fails.  I am assuming it has something to do with not having the correct key.der (I am still using the one from the sample).

In the OUYA developer portal is where you create a Game and assign a bundle id. When you’ve created the game record, you’ll see the signing key download. It’s the same place where you upload builds.

Ah, great.  Thank you!  That fixed it.  Moving on to testing receipts.  Should be smooth sailing from this point.

I am getting this when trying to prepare a build of the sample on a Mac with Corona Pro:

2013-09-06 14:33:23.425 Corona Simulator[37482:707] Copyright (C) 2009-2013 C o r o n a L a b s I n c . 2013-09-06 14:33:23.426 Corona Simulator[37482:707] Version: 2.0.0 2013-09-06 14:33:23.426 Corona Simulator[37482:707] Build: 2013.1202 2013-09-06 14:33:23.428 Corona Simulator[37482:707] The file sandbox for this project is located at the following folder: (/Users/tonygod/Library/Application Support/Corona Simulator/OuyaCoronaPlugin-D85458E18E8025AB7924AA842FE23919) 2013-09-06 14:33:24.210 Corona Simulator[37482:707] PluginSync: downloading plugin: http://plugins.coronasphere.com/tv.ouya/plugin.ouya/2013.1202/mac-sim/plugin.ouya.zip 2013-09-06 14:33:24.368 Corona Simulator[37482:707] plugin.ouya is not supported on this platform

Any advice?

Oh you just see that when opening on the Mac in the simulator. It actually has to run on the OUYA to execute the Java code to invoke IAP.

You should be able to open the main.lua here in the simulator and build for android.

https://github.com/ouya/ouya-sdk-examples/tree/master/Corona/Submission/ouya/samples/InAppPurchasesPlugin/Corona

And then run:

adb install -r the.apk

Ok, thanks.  That makes sense.  Next build problem I am having is this.  I have not seen this one before.

2013-09-06 15:09:04.077 Corona Simulator[37556:707] Copyright (C) 2009-2013 C o r o n a L a b s I n c . 2013-09-06 15:09:04.078 Corona Simulator[37556:707] Version: 2.0.0 2013-09-06 15:09:04.078 Corona Simulator[37556:707] Build: 2013.1202 2013-09-06 15:09:04.083 Corona Simulator[37556:707] The file sandbox for this project is located at the following folder: (/Users/tonygod/Library/Application Support/Corona Simulator/OuyaCoronaPlugin-D85458E18E8025AB7924AA842FE23919) 2013-09-06 15:09:04.626 Corona Simulator[37556:707] plugin.ouya is not supported on this platform 2013-09-06 15:09:29.329 Corona Simulator[37556:707] Using Custom Build Id 72436d308ba9c37eb8ddd77791fb8968 2013-09-06 15:09:49.064 Corona Simulator[37556:707] Connection error: (corona.get) fault(/CFStreamFault) 2013-09-06 15:09:49.064 Corona Simulator[37556:707] Connection error: (corona.get) ({ "/FaultCode" = "-65794"; "/FaultExtra" = { domain = 1; error = 57; msg = "Stream Error"; }; "/FaultString" = "/CFStreamFault"; "/kWSResultIsFault" = 1; }) 2013-09-06 15:09:49.065 Corona Simulator[37556:707] ERROR: Unexpected empty response from build server 2013-09-06 15:09:49.268 Corona Simulator[37556:707] Connection error: (user.logout) fault(/CFStreamFault) 2013-09-06 15:09:49.268 Corona Simulator[37556:707] Connection error: (user.logout) ({ "/FaultCode" = "-65794"; "/FaultExtra" = { domain = 1; error = 57; msg = "Stream Error"; }; "/FaultString" = "/CFStreamFault"; "/kWSResultIsFault" = 1; }) 

Never mind!  It seemed to be an intermittent network issue that is gone now and I got it to build and deploy on my Ouya!

Now on the OUYA dev portal you’ll register a game and enter a package/bundle identifier. Then download the signing key (key.der) and put it into your Corona folder. Set your developer UUID in

https://github.com/ouya/ouya-sdk-examples/blob/master/Corona/Submission/ouya/samples/InAppPurchasesPlugin/Corona/plugin_ouya.lua

plugin_ouya.developerId = “310a8f51-4d6e-4ae5-bda0-b93878e5f5d0”;

And if it all matches, you’ll be in business.

You’ll create an entitlement/consumable for purchase and you’ll see how it’s invoked in the inputs.lua script.

https://github.com/ouya/ouya-sdk-examples/blob/master/Corona/Submission/ouya/samples/InAppPurchasesPlugin/Corona/inputs.lua

Request a purchase using the “purchasbale” id that you create in the developer portal.

plugin_ouya.asyncLuaOuyaRequestPurchase(callbacksRequestPurchase.onSuccess, callbacksRequestPurchase.onFailure, callbacksRequestPurchase.onCancel, purchasable);

And you should see the in-app-purchase dialog.

Thanks, that extra bit got me into my own products and I have it all working with a modified sample.  It is so great to have this Corona/OUYA integration at this point!

Where do I download the correct signing key from?  I am trying to test completing the purchase today and it always fails.  I am assuming it has something to do with not having the correct key.der (I am still using the one from the sample).

In the OUYA developer portal is where you create a Game and assign a bundle id. When you’ve created the game record, you’ll see the signing key download. It’s the same place where you upload builds.

Ah, great.  Thank you!  That fixed it.  Moving on to testing receipts.  Should be smooth sailing from this point.

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 -