Google describes Android as:
The first truly open and comprehensive platform for mobile devices, all of the software to run a mobile phone but without the proprietary obstacles that have hindered mobile innovation.googleblog.blogspot.com/2007/11/wheres-my-gphone.html
Android is made up of several necessary and dependent parts including the following:
❑A hardware reference design that describes the capabilities required of a mobile device in order to support the software stack
❑A Linux operating system kernel that provides the low-level interface with the hardware, mem-ory management, and process control, all optimized for mobile devices
❑Open source libraries for application development including SQLite, WebKit, OpenGL, and a media manager
❑A run time used to execute and host Android applications, including the Dalvik virtual machine and the core libraries that provide Android specific functionality. The run time is designed to be small and efficient for use on mobile devices.
❑An application framework that agnostically exposes system services to the application layer, including the window manager, content providers, location manager, telephony, and peer-to-peer services
❑ A user interface framework used to host and launch applications ❑ Preinstalled applications shipped as part of the stack
❑A software development kit used to create applications, including the tools, plug-ins, and documentation
At this stage, not all of the Android stack has been released as open source, although this is expected to happen by the time phones are released to market. It’s also worth noting that the applications you develop for Android do not have to be open source.
What really makes Android compelling is its open philosophy, which ensures that any deficiencies in user interface or native application design can be fixed by writing an extension or replacement. Android provides you, as a developer, the opportunity to create mobile phone interfaces and applications designed to look, feel, and function exactly as you image them.
Native Android Applications
Android phones will normally come with a suite of preinstalled applications including, but not limited to:
❑ An e-mail client compatible with Gmail but not limited to it ❑ An SMS management application
❑A full PIM (personal information management) suite including a calendar and contacts list, both tightly integrated with Google’s online services
❑A fully featured mobile Google Maps application including StreetView, business finder, driving directions, satellite view, and traffic conditions
❑ A WebKit-based web browser ❑ An Instant Messaging Client
❑A music player and picture viewer
❑ The Android Marketplace client for downloading thied-party Android applications. ❑ The Amazon MP3 store client for purchasing DRM free music.
All the native applications are written in Java using the Android SDK and are run on Dalvik.
The data stored and used by the native applications — like contact details — are also available to third-party applications. Similarly, your applications can handle events such as an incoming call or a new SMS message.
The exact makeup of the applications available on new Android phones is likely to vary based on the hardware manufacturer and/or the phone carrier or distributor. This is especially true in the United States, where carriers have significant influence on the software included on shipped devices.
Android SDK Features
The true appeal of Android as a development environment lies in the APIs it provides.
As an application-neutral platform, Android gives you the opportunity to create applications that are as much a part of the phone as anything provided out of the box. The following list highlights some of the most noteworthy Android features:
❑ No licensing, distribution, or development fees ❑ Wi-Fi hardware access
❑GSM, EDGE, and 3G networks for telephony or data transfer, allowing you to make or receive calls or SMS messages, or to send and retrieve data across mobile networks
❑Comprehensive APIs for location-based services such as GPS
❑Full multimedia hardware control including playback and recording using the camera and microphone
❑ APIs for accelerometer and compass hardware ❑ IPC message passing
❑Shared data stores
❑An integrated open source WebKit-based browser
❑ Full support for applications that integrate Map controls as part of their user interface ❑ Peer-to-peer (P2P) support using Google Talk
❑Mobile-optimized hardware-accelerated graphics including a path-based 2D graphics library and support for 3D graphics using OpenGL ES
❑Media libraries for playing and recording a variety of audio/video or still image formats
❑An application framework that encourages reuse of application components and the replace-ment of native applications
Access to Hardware including Camera, GPS, and Accelerometer
Android includes API libraries to simplify development involving the device hardware. These ensure that you don’t need to create specific implementations of your software for different devices, so you can create Android applications that work as expected on any device that supports the Android software stack.
The Android SDK includes APIs for location-based hardware (such as GPS), camera, network connec-tions, Wi-Fi, Bluetooth, accelerometers, touch screen, and power management. You can explore the pos-sibilities of some of Android’s hardware APIs in more detail in Chapter 10.
Native Google Maps, Geocoding, and Location-Based Services
Native map support lets you create a range of map-based applications that leverage the mobility of Android devices. Android lets you create activities that include interactive Google Maps as part of your user interface with full access to maps that you can control programmatically and annotate using Android’s rich graphics library.
Android’s location-based services manage technologies like GPS and Google’s GSM cell-based location technology to determine the device’s current position. These services enforce an abstraction from spe-cific location-detecting technology and let you specify minimum requirements (e.g., accuracy or cost) rather than choosing a particular technology. It also means that your location-based applications will work no matter what technology the host handset supports.
To combine maps with locations, Android includes an API for forward and reverse geocoding that lets you find map coordinates for an address, and the address of a map position.
You’ll learn the details of using maps, the geocoder, and location-based services in Chapter 7.
Android supports applications and services designed to run invisibly in the background.
Modern mobiles are by nature multifunction devices; however, their limited screen size means that generally only one interactive application can be visible at any time. Platforms that don’t support back-ground execution limit the viability of applications that don’t need your constant attention.
Background services make it possible to create invisible application components that perform automatic processing without direct user action. Background execution allows your applications to become event-driven and to support regular updates, which is perfect for monitoring game scores or market prices, generating location-based alerts, or prioritizing and pre-screening incoming calls and SMS messages.
Learn more about how to get the most out of background services in Chapter 8.
SQLite Database for Data Storage and Retrieval
Rapid and efficient data storage and retrieval are essential for a device whose storage capacity is limited by its compact nature.
Android provides a lightweight relational database for each application using SQLite. Your applications can take advantage of the managed relational database engine to store data securely and efficiently.
By default, each application database is sandboxed — its content is available only to the application that created it — but Content Providers supply a mechanism for the managed sharing of these application databases.
Databases, Content Providers, and other data persistence options available in Android are covered in detail in Chapter 6.
Shared Data and Interapplication Communication
Android includes three techniques for transmitting information from your applications for use else-where: Notifications, Intents, and Content Providers.
Notifications are the standard ways in which a mobile device traditionally alerts users. Using the API, you can trigger audible alerts, cause vibration, and flash the device’s LED, as well as control status bar notification icons as shown in Chapter 8.
Intents provide a mechanism for message passing within and between applications. Using Intents, you can broadcast a desired action (such as dialing the phone or editing a contact) system-wide for other applications to handle. Intents are an important core component of Android and are covered in depth in Chapter 5.
Finally, Content Providers are a way to give managed access to your application’s private database. The data stores for native applications, such as the Contact Manager, are exposed as Content Providers so you can create your own applications that read or modify these data stores. Chapter 6 covers Content Providers in detail, including the native providers and demonstrating how to create and use providers of your own.
P2P Services with Google Talk
Based on earlier SDK versions, it’s expected that in later releases you will once again be able to send structured messages from your application to any other Android mobile using Android’s peer-to-peer (P2P) communications service.
The Android P2P service uses a specialized version of XMPP (Extensible Messaging and Presence Protocol). Based on Google’s Google Talk instant messaging service, it creates a persistent socket con-nection between your device and any other online Android handset that ensures communication with low latency and rapid response times.
When made available, you’ll be able to use the Google Talk service for conventional instant messaging, or an interface to send data between application instances on separate devices. This is strong sauce for creating interactive applications that involve multiple users, such as real-time multiplayer games or social applications.
The P2P service also offers presence notification, which is used to see if a contact is online. While the P2P service is very attractive in itself, it also plays very well with other Android features. Imagine a background service that transmits locations between friends and a corresponding mapping application that displays these locations or alerts you when friends are nearby.
Owing to security concerns, sending data messages with Google Talk isn’t possible in Android 1.0. An instant messaging client is available, and it’s expected that XMPP-compatible IM and data messaging will be made available to developers in a future SDK release.
Extensive Media Support and 2D/3D Graphics
Bigger screens and brighter, higher-resolution displays have helped make mobiles multimedia devices. To make the most of the hardware available, Android provides graphics libraries for 2D canvas drawing and 3D graphics with OpenGL.
Android also offers comprehensive libraries for handling still images, video, and audio files including the MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, and GIF formats.
2D and 3D graphics are covered in depth in Chapter 11, while Android media management libraries are covered in Chapter 10.
Optimized Memory and Process Management
Android’s process and memory management is a little unusual. Like Java and .NET, Android uses its own run time and virtual machine to manage application memory. Unlike either of these frameworks, the Android run time also manages the process lifetimes. Android ensures application responsiveness by stopping and killing processes as necessary to free resources for higher-priority applications.
In this context, priority is determined depending on the application with which the user is interacting. Ensuring that your applications are prepared for a swift death but are still able to remain responsive and update or restart in the background if necessary, is an important consideration in an environment that does not allow applications to control their own lifetimes.
You will learn more about the Android application life cycle in Chapter 3.