Over the next several weeks, Android 1.6 will be rolling out to customers via an over-the-air update. In addition to a number of user-facing features such as a new Android Market and a faster camera application, the Donut branch has a few goodies for developers as well. This article explores how to get 1.6 right now, and the developer-facing features inside.
[ See also: What's new in Android 1.6? Part 1: User features ]
Continue reading: Getting 1.6 early >
Getting 1.6 early
Can't wait for the regular update? The 1.6 SDK is available for download now. It contains an emulator for a virtual Android device so you can develop and test your programs on your desktop machine. Windows, Linux, and MacOS are supported.
Want to see it running on a real phone? If you have an ADP1 or Google Ion phone, download the latest version from the HTC support site. Be sure to follow the link specifically for your hardware: Android Dev Phone 1, and Google I/O Device (Ion). I tried the directions for the Ion and they worked like a charm.
For other kinds of phones such as the T-Mobile G1 and MyTouch3G, Taylor Wimberly and Ben Marvin have written a couple of articles that have downloading and install instructions. Be sure to read all the warnings and comments about potential problems with a manual update, especially if you are running a custom or rooted Android ROM.
Now that you have 1.6, let's look at the developer-facing changes in the new version.
Continue reading: Developer features >
1.6 is a minor release of Android, which means that there are only a handful of changes in the Android application programming interface (API). The official API diffs page lists 538 removals, additions, and other changes to the API between 1.5 (Cupcake) and 1.6 (Donut). However this number is misleading. When a class is deprecated in one place and moved to another, every method and field in the class is counted twice. So the actual number of changes is much lower. Here are the highlights:
- Support for multiple screen sizes and densities. Applications targeting 1.6 are assumed to support different screen densities and sizes. They can still explicitly specify screen support either way with the supports-screens manifest tag.
- New permissions. 1.6 programs must explicitly request the WRITE_EXTERNAL_STORAGE permission to be able to modify the contents of the SD card, and they must explicitly request the READ_PHONE_STATE permission to be able to be able to retrieve phone state info. Apps targeting earlier versions will always request these permissions implicitly.
- New audio sources. In 1.6, you can record audio from the VOICE_CALL, VOICE_DOWNLINK, and VOICE_UPLINK channels (hardware permitting).
- Text to speech (previously available as a 3rd party library).
- Path-based permissions. In 1.5 you either had full access or no access to all the paths exposed by a Content Provider. In 1.6 the developer can restrict access based on particular paths.
- Gesture strokes. Android 1.6 provides some limited support for defining gestures (distinctive finger movements) in your own applications. So far, none of the standard apps have taken advantage of this.
- WiFi multicast. This will make it possible for apps running on the same WiFi network to discover and talk to each other.
- OpenGL changes. Some of the classes in javax.microedition.khronos have been deprecated and moved to android.opengl. I'm not really sure they will stay there though, so there's no urgency to change your code. More interesting are the hints that Android will be supporting OpenGL 2.0 in a future release. You can now specify the OpenGL version number that you require in your Android manifest.
- CDMA support. Unless you're generating GSM/CDMA tones in your program you probably don't care about this.
- android.os.Build.VERSION_CODES. Before making a call to a new API, you can test to see which version of Android you are running on.
Continue reading: Schizo-screenia >
By far, the most important change in 1.6 is support for different screen sizes. This is the only change in 1.6 that most developers need to worry about. 1.6 is the first release that can really support screens that are larger or smaller than the standard 320x480 HVGA display that has been used so far on all Android phones. The first phone to take advantage of this will likely be the HTC Tatoo, which will have a 240x320 screen. The Motorola Sholes/Tao, due out later this year, will have a 480x800 screen, and some netbooks will use 480x854 or bigger.
When running an older application on a 1.6 phone, Android will attempt to scale the user interface to the new size. However, it doesn't always do a great job of this. Small screens are particularly difficult to support so on those phones Google decided to limit the Market so that 1.5 apps will not even appear in the list of available applications users can download. So it's important that all Android programs be updated sooner or later to target the new version. In a future article I'll explore how you can have a single program that support multiple screen sizes and versions of Android.