Mobile devices create an amazing ecosystem for developers to express new ideas, create new business, and expand existing worlds. Services like GameCircle and In-App Purchasing make those experiences more sticky and re-playable, drawing users into the experience with more depth. Another category of ecosystem depth that we've been focusing on is app-enabled accessories. Kindle Fire (as well as other Android devices) can connect to and control an incredible range of new devices, and a couple weeks ago we launched a few of these devices on Amazon.com as official Kindle accessories, creating new ways and new opportunities for developers to connect with Amazon customers.
From the self-stabilizing, Kindle-controllable AR.Drone and the high-tech Nest learning thermostat, to the Sonos wireless music system and the Nexia home automation system, there's virtually no limit to what an application can do with the right accessories.
I've had the opportunity to try out some of the development experiences the devices provide, and I wanted to share just how easy it is to get started. I've chosen the Philips Hue personal wireless lighting system, the starter-kit for which will be available for pre-order on the Amazon App Enabled Accessories store this week. Hue lights connect to a Wireless bridge that connects to your network, and exposes a RESTful API for control over the bulbs -- either individually or in groups. Accessing this API in Android, for Kindle and other devices, is pretty simple...
Once you've got everything connected, you can get started by authenticating as a new developer directly on the bridge:
Enter the root API url "/api" and send a JSON object containing your new developer identity:
Submit the form with POST. You'll get an error back telling you to push the link button on your bridge. Press it, then POST again, and you're in. This creates your development URL on the bridge, separating your commands from any other app. You can now send commands to the URL:
From here, you can send commands to groups:
Get state, or send commands to individual lights:
Here's some Android code telling the bridge to turn all the lights to blue...
HttpClient httpClient = new DefaultHttpClient();
HttpPut httpPut = new HttpPut("http://<bridgeip>/api/kindledev/groups/0/action");
JSONObject lampMsg = new JSONObject();
lampMsg.put("on", true); //set the lamps to on
lampMsg.put("sat", 255); //set the saturation to 255
lampMsg.put("bri", 255); //set the brightness to 255
lampMsg.put("hue", 46360); //set the hue to blue
StringEntity se = new StringEntity(lampMsg.toString());
HttpResponse response = httpClient.execute(httpPut);
Full documentation on the Hue API can be found on their website.
The other devices I mentioned all have programmability interfaces as well. Their own apps hit Amazon a couple weeks ago, but we can't wait to see what other experiences the developer community can create with them!