Saturday, September 14, 2013

Get Started With Kindle Fire Programming: Apps & Games

You may be wondering whether it's worth your time to learn about Kindle programming. If so, you can consider two things: 1. If you have learned (or are going to learn) Android mobile app programming you are (or will be) well on your way to programming for Kindle. 2. While hundreds of iPhone and Android customers have taken time to add comments, on Amazon, for their devices--over 17,000 customers have taken time to pledge their allegiance and declare their love for Kindle. This means, there are a lot of customers out on the lookout for new apps or games to install on their beloved Kindle. So, if you want to learn Kindle programming basics this article will help you get started.

Introducing Amazon Kindle

Amazon Kindles fall into two categories: Kindle E-readers and Kindle Fire Tablets. Kindle E-readers include the Kindle Paperwhite 3G, the Kindle and the Kindle DX devices. The E-readers enable users to download and access digital books, audio books and magazines.

Kindle Fire Tablets include the Kindle Fire HD 8.9 Tablet (and 8.9 4.G Tablet), the Kindle Fire HD Tablet and the Kindle Fire Tablet. The Tablets are designed to give customers a broader range of capabilities including stereo speakers for virtual surround sound, faster downloading and streaming speed. And, most importantly, customers can use their Tablets to enjoy movies, TV shows, music, magazines, digital books, audiobooks, games and apps-- including popular social networking apps such as Facebook and Twitter. This article focuses on programming for Kindle Fire devices.

Getting Started

To get started with Amazon Kindle application or game development developers must set up the Android Development Environment for Eclipse. For more information on setting up Eclipse see the  article titled, "Mobile Software Programming: Designing & Building Mobile Apps (Android)." Once the Eclipse development environment is ready to develop Android apps; it's a good idea to create an Android app to verify that the development environment is set up properly. This way as you configure the development environment to code and run Kindle Fire apps you can narrow down troubleshooting problems.

Once your development environment runs an Android app without errors you can then setup your environment to build and deploy Kindle Fire apps and games. To begin setting up Eclipse to build Kindle Fire apps or games you will need to visit the following location to download the Amazon Mobile SDK: When you click the Download SDK button you will be prompted to download the file. If you scroll down the page you will notice this page also provides an overview for each API included in the SDK. You can navigate to the following link to learn how to install the SDK: .

Amazon Mobile SDK

When you install the Amazon Mobile SDK, Amazon JAR files, API documentation and other files are added to your computer. Note that as you step through the Amazon Mobile SDK installation process you will see a screen similar to the one below; however, the top-level list items are collapsed so the child items are not visible. You will select the Accept License option button on the bottom right.

To accept the "license use" for the child items, you will need to expand the top-level  (or parent)  item to view the child items. You can then use the Accept option button that becomes enabled on the bottom left. (Hopefully this tidbit will save you a bit of frustration that would come from assuming the "Accept License" option button on the right lets you accept license use for both parent and child items.)

The SDK API files and folder structure is discussed on the following page: When you install the Amazon Mobile SDK (see the section titled Installing SDK Add-Ons at folders and files are installed in the extras folder in the Android SDK folder (the following picture shows the extras folder in the Android SDK - ADT Bundle for Windows folder).

The amazon folder (added to the extras folder) includes two folders: DeviceProfiles and kindle_fire_usb_driver. The DeviceProfiles folder includes the devices.xml file, which includes definitions for the Kindle Fire virtual devices (a portion of the devices.xml file is shown below).

The kindle_fire_usb_driver folder includes the KindleDriver.exe. This is the file that is executed to install the drivers for the Kindle Fire emulator devices. The intel folder pertains to the emulators and is discussed below.

Kindle Fire Emulators

You can use ARM-based system images or x86 system images when configuring the Kindle Fire emulators. The x86 system images enable you to use an accelerator so that the loading and running speed of the emulator is comparable to that of a real Kindle Fire Tablet. The intel folder, in the extras folder discussed above, includes the Hardware_Accelerated_Execution_Manager folder. This folder includes the IntelHaxm.exe used to install the Intel Hardware Accelerated Execution Manager (HAXM) after you have enabled the visualization extensions on your computer, as shown in the following picture. (For more information see the section title Setting Up the x86 System Images for Faster Emulation and visit

If you are not able to configure your computer to use the x86 system images you can still use the ARM-based system images. After you start Eclipse you can select Window -> Android Virtual Device Manager. If the SDK is installed properly you will see that Kindle Fire devices have been added to the Device list (as shown in the picture below). And, Kindle Fire APIs have been added to your Target list. If you want to create an emulator simply click the New button on the Android Virtual Device Manager. The following link provides documentation regarding what API should be associated with each emulated device:

As you create a virtual device you can indicate the type of image you want to use, as shown in the following picture.

Keep in mind that when setting up the devices the SD card and Internal Storage size both impact the amount of time it will take to start and run the device. If you have a large SD card/Internal Storage size you can expect the device to take some time to start. If you want to test your emulators to make sure they load properly before installing your app on the emulator you can access the Android Virtual Device Manager, select the desired emulator then click the Start button. Again, your computer and device configuration will drive how much patience you will need to exercise while waiting for the device to turn on and start, as shown in the picture below.

When you are ready you can follow Amazon's instructions to get started by creating a basic "hello app". This tutorial is located at: With your virtual device (emulator) working and your app created you can run your application using the desired device(s). There are several emulator devices to choose from including the First Generation Kindle Fire, the Second Generation Kindle Fire, Kindle Fire HD, etc. Below are pictures showing the simple sample app running on the First Generation and Second Generation Kindle Fire emulator devices.

First Generation Kindle Second Generation Kindle

The following documentation provides more information on the Kindle Fire device specifications to help you better determine the devices to which you would like to make your apps available: If you have a Kindle Fire Table, you use your device instead of (or in addition to) the emulators to test your apps. For more information see Setting Up Your Kindle Fire Tablet for Testing at

Game Programming - Amazon GameCircle API

Amazon GameCircle provides the API and other tools needed to build game achievements and leaderboards for Kindle Fire games. It also provides the API needed to implement Whispersync so customers can save game progress to the cloud. (You can read an introduction to achievements and leaderboards by reviewing the section titled: A Mobile Game Application in my previous article titled Mobile Software Programming: Designing & Building Mobile Apps (Android).)

To get started with GameCircle you will need an account on Amazon's Mobile Apps Distribution site at . Next you have to create a security profile for your apps.

Once you add a new security profile for your application(s) Amazon automatically generates a ClientID and a Client Secret value. These two values are part of your apps' security profile credentials.  The API Key allows Amazon to verify your app's identity. In addition to the API Key, Credentials are also required.  As part of the Credentials the developer provides the API Key name, a package name and an MD5 signature. A complete security profile is then created for the application (as shown below). For more information on GameCircle configuration visit

(Note:  Keys can be generated or existing digital signatures can be viewed using the Java keytool, which is a key and certificate management tool that manages a keystore used to store cryptographic keys, certificates, etc. These concepts are all part of the public/private key infrastructure (PKI). Certificates and digital signatures can be used to establish the origin of software, with a degree of certainty, based on the underlying cryptography algorithm used. Note that when you install the JDK the keystore tool is added to your computer. And, when you install the Android SDK a debug.keystore file is added to your computer. You can use your computer's search feature to find these files.)

Once you have completed your security profile you can then link your security profile to a GameCircle configuration, as shown in the following picture.

Once you have linked your security profile you can click the View link under leaderboards (in GameCircle, as shown in the above picture) to add leaderboards. And, you can code your leaderboards in Eclipse. To learn more about Kindle Fire Leaderboards you can visit

You can also click the View link under Achievements (in GameCircle) to add Achievements. And, you can use Eclipse to code your game achievements. To learn more about Kindle Fire game achievements you can visit You can also code your game to use Whispersync so customers can access the game and continue playing from any mobile device.

Once you're ready to test your app you can add your testing nickname to GameCircle. You can also associate the applicable leaderboards and achievements to your testing nickname to test your game. For more information see and

For Programmers Who Need Free Access to a Robust Development Environment

For hard-core programmers and game developers a robust programming and testing environment may be required. Whether you plan to build business applications, mobile games, massively multiplayer online (MMO) games or even social networking games for apps like Facebook you may consider trying Amazon Web Services (AWS). To help new AWS customers get started with AWS, Amazon provides information on how usage limits that will enable you to use AWS for free. The AWS Free Usage Tier can be used to gain hands-on experience with AWS; or,  to practice building large-scale games or apps. Visit and look at the section titled AWS Free Usage Tier (Per Month) to see usage limits if you don't want to be charged to use AWS or want to keep charges to a minimal.

There is also an AWS Toolkit for Eclipse, which makes it easier for developers to develop locally or even share files with developers in other locations, if applicable.

A future article will provide more detailed information on programming applications using AWS; and,  distributing your apps/games on Amazon.