Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## tv.ouya.console.api
Class OuyaFacade

    java.lang.Object
      tv.ouya.console.api.OuyaFacade

All Implemented Interfaces:
  android.content.ServiceConnection

    public class OuyaFacade

extends java.lang.Object
implements android.content.ServiceConnection

Entry point for the OUYA API. Applications should use the singleton instance.

Calls are asynchronous, so results are returned via client provided `OuyaResponseListener` objects.

Method Summary
`boolean` | `bindRequestHasBeenMade()` Deprecated.
`java.lang.String` | `getGameData(java.lang.String name)` Get a piece of previously stored game data.
`static OuyaFacade` | `getInstance()` Returns the OuyaFacade singleton.
`static int` | `getOdkVersionNumber()`
`void` | `init(android.content.Context context, java.lang.String developerId)` Initializes the facade.
`boolean` | `isInitialized()` Returns whether the OuyaFacade has been initialized.
`boolean` | `isRunningOnOUYAHardware()` Test to see if we're running on an OUYA console.
`void` | `onServiceConnected(android.content.ComponentName componentName, android.os.IBinder iBinder)` Called when the service is connected.
`void` | `onServiceDisconnected(android.content.ComponentName componentName)` Called when the service is disconnected.
`void` | `putGameData(java.lang.String name, java.lang.String value)` Store some game data.
`void` | `requestGamerUuid(OuyaResponseListener<java.lang.String> gamerUuidListener)` Requests the current gamer's UUID.
`void` | `requestProductList(java.util.List<tv.ouya.console.api.Purchasable> purchasables, OuyaResponseListener<java.util.ArrayList<tv.ouya.console.api.Product>> productListListener)` Returns a list of `Product` objects that describe the products (including current price) associated with the specified list of `Purchasable`s.
`void` | `requestPurchase(tv.ouya.console.api.Purchasable purchasable, OuyaResponseListener<java.lang.String> purchaseListener)` Requests that the specified Purchasable be purchased on behalf of the current user.
`void` | `requestReceipts(OuyaResponseListener<java.lang.String> receiptListListener)` Requests receipts for all of the purchases that the current gamer has made from a particular vendor.
`void` | `setTestMode()` Enables 'test mode' for making purchases without charging real money.
`void` | `shutdown()` Shuts down the facade.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getInstance

    public static OuyaFacade getInstance()

  Returns the OuyaFacade singleton.

  Returns:
    The singleton.

### getOdkVersionNumber

    public static int getOdkVersionNumber()

  Returns:
    an int representing the version number of the ODK in use.

### init

    public void init(android.content.Context context,
                     java.lang.String developerId)

  Initializes the facade. Should only be called once.

  Parameters:
    `context` - An Android Context object.
    `developerId` - The developer UUID, which is obtained from the developer portal.

### shutdown

    public void shutdown()

  Shuts down the facade.

  Note: Call `shutdown` before the program exits. Otherwise, the internal `BroadcastReceiver` will be leaked.

### isInitialized

    public boolean isInitialized()

  Returns whether the OuyaFacade has been initialized.

  Returns:
    true if the OuyaFacade has already been initialized; otherwise, false.

### isRunningOnOUYAHardware

    public boolean isRunningOnOUYAHardware()

  Test to see if we're running on an OUYA console.

  Returns:
    true if the device we're on is an OUYA, false if not.

### setTestMode

    public void setTestMode()

  Enables 'test mode' for making purchases without charging real money. In this mode the purchase dialog will be coloured red for easy notification. Do not submit apps with test mode enabled!

### putGameData

    public void putGameData(java.lang.String name,
                            java.lang.String value)

  Store some game data. This will be held outside of the game area an so won't be affected by uninstalling and re-installing a game. This may, however, be removed from the system if it is unused for a long period of time or is taking up a large amount of space.

  Parameters:
    `name` - The name of the piece of game data to store.
    `value` - The value to store.

### getGameData

    public java.lang.String getGameData(java.lang.String name)

  Get a piece of previously stored game data.

  Parameters:
    `name` - The name of the piece of information to get.
  Returns:
    The value, or null if the value does not exist.

### requestProductList

    public void requestProductList(java.util.List<tv.ouya.console.api.Purchasable> purchasables,
                                   OuyaResponseListener<java.util.ArrayList<tv.ouya.console.api.Product>> productListListener)

  Returns a list of `Product` objects that describe the products (including current price) associated with the specified list of `Purchasable`s.

  Parameters:
    `purchasables` - The Purchasable objects that identify the products to be returned.
    `productListListener` - A listener object that will asynchronously receive the `Product`s

### requestPurchase

    public void requestPurchase(tv.ouya.console.api.Purchasable purchasable,
                                OuyaResponseListener<java.lang.String> purchaseListener)

  Requests that the specified Purchasable be purchased on behalf of the current user.

  The IAP client service is responsible for identifying the user and requesting credentials as appropriate, as well as providing all of the UI for the purchase flow. When purchases are successful, a `Product` object is returned that describes the product that was purchased.

  Parameters:
    `purchasable` - The Purchasable object that describes the item to be purchased.
    `purchaseListener` - A listener object that will asynchronously receive the results of the purchase request

### requestReceipts

    public void requestReceipts(OuyaResponseListener<java.lang.String> receiptListListener)

  Requests receipts for all of the purchases that the current gamer has made from a particular vendor.

  Parameters:
    `receiptListListener` - A listener object that will asynchronously receive the list of receipts for all purchases ever made by the gamer to whom the console is currently registered.

### requestGamerUuid

    public void requestGamerUuid(OuyaResponseListener<java.lang.String> gamerUuidListener)

  Requests the current gamer's UUID.

  Parameters:
    `gamerUuidListener` - A listener object that will asynchronously receive the UUID of the gamer to whom the console is currently registered.

### bindRequestHasBeenMade

    @Deprecated
    public boolean bindRequestHasBeenMade()

  Deprecated.

  This method is used for testing only.

### onServiceConnected

    public void onServiceConnected(android.content.ComponentName componentName,
                                   android.os.IBinder iBinder)

  Called when the service is connected.

  This is part of Android's `ServiceConnection` interface, and it is not client consumable.

  Specified by:
    `onServiceConnected` in interface `android.content.ServiceConnection`
  Parameters:
    `componentName` - The name of the service that has been connected.
    `iBinder` - The `IBinder` object for that service.

### onServiceDisconnected

    public void onServiceDisconnected(android.content.ComponentName componentName)

  Called when the service is disconnected.

  This is part of Android's `ServiceConnection` interface, and it is not client consumable.

  Specified by:
    `onServiceDisconnected` in interface `android.content.ServiceConnection`
  Parameters:
    `componentName` - The name of the service that has been disconnected.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2012 OUYA, Inc. All Rights Reserved.