Calling Into OuyaSDK.IsOuya

As mentioned here and here, the OUYA SDK provides a static method you can call to tell if the device is an OUYA or not:

OuyaSDK.IsOuya() // true or false

(Pending the caveat that as the OUYA OS goes to different hardware, what this means might change.)

Is it possible to expose this through OpenFL? I’m not sure how exactly OpenFL integrates with the SDK. (extension-ouya seems like it’s not updated any more.)

It’s possible to expose this method through the extension,
openfl uses JNI to integrate with the SDK.

It’d be something along the line of:

public static function isOuya () : Bool {
  if (_isOuya == null) {
    _isOuya = openfl.utils.JNI.createStaticMethod("OuyaSDK", "IsOuya", "()Z", true);

  return _isOuya();
private static var _isOuya : Dynamic;

(if I understood correctly how JNI works)

@ibilon is that extension still maintained/active? I noticed it does have a reference to the OUYA ODK jar.

I’d say it’s not maintained anymore since it looks like it’s targeting the ODK version 1.0.8,

but if you need this extension it shouldn’t be too hard to put it up to date, looks pretty straighforward once you get the wrapping mechanism.

Contributions welcome :slight_smile:

Certainly, I can take a look.

My question is, where is the OpenFL code today for any integration with OUYA? It must be somewhere (I couldn’t find it). HaxeFlixel has some classes for input detection, but I thought that’s just wrapping over OpenFL code (couldn’t find that, either).

Extensions are exactly what their names imply, extensions,
no class in openfl.* builds on top of them.

What kind of integration are you looking for?

I don’t know much about haxeflixel’s source code, but I do for haxepunk’s,
in the input to deal with the ouya controler we do it ourself

But nothing prevent you to build an api on top of them to mimick the openfl/flash api when/if that make sense.

People can help improve that extension, of course. It does not include the ODK because it only called a few things in JNI (I think) which we were able to recreate without the library, I think licensing terms meant we could not include the JAR directly. If they do allow inclusion of the JAR then that might be a better solution moving forward as they add things