Android

Optional APIs in Android

Android is suitable for a wide variety of phones, from high-end smartphones on down. The core Android APIs will be available on every Android phone, but there are a few APIs which have special concerns: the "optional" APIs.

These are "optional" in the sense that a given handset may not support them fully, or even at all. For instance, a given handset may not have GPS or Wi-Fi hardware. In this case, the APIs for accessing these features will still be present, but they may not work in the same way. For instance, the Location API will still exist on devices without GPS, but there may simply be no installed provider, meaning that the API can't be usefully used.

Your application won't have trouble running or linking on a device that doesn't support an API you use, because the classes will be present on the device. However, the implementations may not do anything, or may throw exceptions when you actually try to use them. What exactly each API does on unsupported devices is described in the documentation for that API; you should be sure to code your application to gracefully handle such cases.

Wi-Fi APIs

The Wi-Fi APIs provide a means by which applications can communicate with the lower-level wireless stack that provides Wi-Fi network access. Almost all information from the device supplicant is available, including the connected network's link speed, IP address, negotiation state, and more, plus information about all other available networks. Some of the available interactions include the ability to scan, add, save, terminate and initiate connections.

The Wi-Fi APIs are in the android.net.wifi package.

Location-Based Services

Location-Based Services (LBS) allow software to obtain the phone's current location. This includes location obtained from the Global Positioning System (GPS) satellite constellation, but it's not limited to that. For instance, other location-based systems may come online in the future, and as they do, support for them can be added to this API.

The Location-Based Services are in the android.location package.

Click here for an introduction to the Android LBS APIs.

Media APIs

The Media APIs are used to play media files. This includes both audio (such as playing MP3s or other music files, as well as game sound effects) and video (such as playing a video downloaded over the web.) Support is included for "playing URIs" — that is, streaming media data over the network. Technically the Media APIs are not optional since they'll always be present; however there may be differences in the specific sets of supported codecs across devices.

The Media APIs are in the android.media package.

Click here for an introduction to the Android Media APIs.

3D Graphics with OpenGL

Android's primary user interface framework is a typical widget-oriented class hierarchy. Don't let that fool you, though — sitting underneath that is a very fast 2D and 3D compositing engine, with support for hardware acceleration. The API used to access the 3D capabilities of the platform is the OpenGL ES API. Like the Media APIs, OpenGL is actually not strictly optional, since the API will always be present and will always function. However some devices may not have hardware acceleration, and thus use software rendering, which may affect the performance of your application.

The OpenGL utilities are in the android.opengl package.

Click here for an introduction to the Android OpenGL API.

Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56