The Fire is based off a heavily modified version of Android 2.3.3 so it was pretty easy to get my first app up and running.
Using the Titanium Sample app, KitchenSink, I’ve outlined below how you can get your Titanium development environment setup and your apps running on the Kindle Fire.
Getting the Kindle Ready
Just like most Android devices you need to allow for the installation of apps from unknown sources.
- Open the options menu
- Select More…
- Select the “Device” option
- Toggle the “Allow Installation of Applications From Unknown Sources” to On
We are now ready to be able to deploy our own apps.
Setup our USB connection
So that our computer can see the Kindle when it is connected via USB we’ll have to make a small update to the adb_usb.ini file.
- Navigate to ~/.android and open the adb_usb.ini file your favorite text editor
- Type 0X1949 at the end of the file, then save and close adb_usb.ini.
- Stop ADB server with the adb kill-server command, then use the adb devices command. You should see the Kindle Fire listed.
For more details please see this article by Technipages.
Setting up our development environment
Next is setting up our development environment.
I am using the following Titanium components:
- The latest version of KitchenSink from Github
- Titanium Mobile SDK 22.214.171.124 using V8 Runtime
- Titanium Studio version 126.96.36.199112152014
After importing the KitchenSink into my Workspace it is time to setup the Android emulator to better reflect the Kindle Fire’s specs.
To download any of the above mentioned components please visit here for how to get started.
The Kindle Fire isn’t a Google Approved build of Android. This means that we don’t have access to a few of the native APIs such as Maps. To handle this, we need to make a few adjustments to the KitchenSink demo.
- Remove the map api keys from the tiapp.xml file
- Remove any of the fields that have references to mapViews.
All of the files that contain references to the MapView are in the Examples folder.
Remove the following:
This will allow you to push to device without any issues. Make sure you update the views.js to remove any references to the files you deleted, or you might tap on a link that doesn’t exist any longer.
Creating the Emulator
Titanium Studio manages the linkage between the Android AVD images and your projects for you. It doesn’t seem as though there is an option for you to specify which AVD image you would like to use.
The best work around seems to be doing the following:
- When in the KitchenSink project go to Debug Configurations under the Run menu
- Select the 2.3.3 for your Android API level and a Screen Size that you usually do not use. I recommend using WVGA854 since this is an easy starting place.
- Then press Apply, then Debug
- This will launch the emulator, wait until you see the KitchenSink app open in the emulator. This means the AVD has fully been created.
- Now close the Android Emulator
- Open the Android AVD Manager. You can do this by going into your Android / Tools folder and issuing the below terminal command
- This will load the Android AVD Manager as shown below.
- Select the AVD Image we just created in Titanium Studio and press the Edit button.
- We now can start to update the AVD to have the same specs as the Kindle Fire. You will want to adjust the resolution to be 600 x 1024, turn off GPS support, change the LCD density to 160, and increase the RAM to 512. You will also want to remove Camera support.
- When finished press the “Edit AVD” button to save your changes.
- Go back into Titanium Studio and Run the KitchenSink project again in Debug. Your emulator should now look like the below.
- Your now ready to test in the emulator and when ready push to device.
Pushing to Device
This is the easy part. Simply connect your Kindle Fire via USB and it your computer a couple of seconds to identify your device.
Before starting the deployment process from within Titanium Studio I recommend updating the tiapp.xml file. You can simply add/remove a space at the end of the file. This will force Titanium to perform a full build during the deployment process.
To start the deployment process, select the Deploy to Device option on your project menu as shown below.
The terminal window in Titanium Studio will indicate when it has connected to your Kindle Fire and will automatically start the build process. Sometimes there is a connection problem and the deployment process cannot find your device. This usually can be fixed by unplugging the USB cable connecting your device, then plugging it back into your computer. You might need to restart the deployment process again.
Does it work on the device?
The simple answer is yes. There are a few things that don’t work due to hardware or software limitations. The Kindle Fire’s theme works well with the Titanium native controls providing a new look and feel considering the app was never designed for this platform.
Overall the KitchenSink works very well on the Kindle Fire. Scrolling, page loads, and general navigation are faster then my Nexus S ( not running the V8 runtime ).
What does it look like?
Using Android Screencast I’ve put together a short walk thru of the Kindle Fire running KitchenSink.
What doesn’t work?
There are a few things that don’t seem to be working on the device.
- MapView – We already talked about this, but the MapView doesn’t work as this is a forked version of Android
- Geo Location – The Titanium.Geolocation.getCurrentPosition method returns “no providers are available”. I guess this is expected as the Kindle Fire doesn’t provide GPS support. Even if you use setPreferredProvider=”network” you will receive the “no providers” error. Seems like Amazon completely removed the geo stack.
- Camera– There is no camera on the Fire so it goes without saying any feature that requires this will not work. The Titanium framework gives you a method to check if a camera is available. If you use this, you wont have any issues.
Other then the obvious screen size differences and lack of mapView support using Titanium on the Kindle Fire doesn’t appear to be any different then building for the Android Phone platforms.
One thing is clear, just as with iPad apps, you will want to design a different user experience for the Kindle Fire. The Kindle’s bottom navigator and darkened theme will most likely have a large impact on your overall app design.
I look forward to experimenting with this new form factor as it is smaller then an iPad but bigger then a phone.
I continue to be impressed with how easy and quickly you can get an app running using Titanium. The fact it only took removing a few files to get the KitchenSink API example app up and running is another example of the flexibility and durability of the Titanium platform.