An3Mote BroadcastApi

An3Mote acts as BroadcastReceiver for at the moment two kinds of actions: An3Mote.ACTION_API_INVOKE,  a broadcast that defines a command to be send to GoogleTV and An3Mote.ACTION_API_STATUS_REQUEST, a broadcast to request the current connection-status and force a connection when there is none. The first Action expects some Extras consisting of command definitions.

See the full api-documentation.

Right now i'm providing just a simple JAR-file containing all the needed constants.


The following code presses the HOME button on the GoogleTV device:


Intent intent = new Intent(An3Mote.ACTION_API_INVOKE);

intent.putExtra(An3Mote.EXTRA_TYPE, An3Mote.TYPE_KEYCODE);
intent.putExtra(An3Mote.EXTRA_KEYCODE, Keycode.KEYCODE_HOME);
sendBroadcast(intent);


This code sends a Intent that gets executed on the GoogleTV device, starting a Youtube video:

Sring uri = "vnd.youtube://" + "oWDrQa6jymc";
Intent videoIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));


Intent intent = new Intent(An3Mote.ACTION_API_INVOKE);
intent.putExtra(An3Mote.EXTRA_TYPE, An3Mote.TYPE_URI);
intent.putExtra(An3Mote.EXTRA_URI, videoIntent.toUri(Intent.URI_INTENT_SCHEME));
sendBroadcast(intent);


As An3Mote is just a small hobby project it is still pretty basic and not that well tested. For the future it's planned to improve it and make it open source. Testers using the sample  application als well as using the this simple api are very welcome of course. Any feedback is welcome (preferably via the testers community).



No comments:

Post a Comment