Login     Sign Up
Innocent Cyril (@admin)
4 months ago
61 Views

Android Libraries

Android offers a number of APIs for developing your applications. The following list of core APIs should provide an insight into what’s available; all Android devices will offer support for at least these APIs:

❑android.util The core utility package contains low-level classes like specialized containers, string formatters, and XML parsing utilities.

❑android.os The operating system package provides access to basic operating system services like message passing, interprocess communication, clock functions, and debugging.

❑android.graphics The graphics API supplies the low-level graphics classes that support can-vases, colors, and drawing primitives, and lets you draw on canvases.

❑android.text The text processing tools for displaying and parsing text.

❑android.database Supplies the low-level classes required for handling cursors when working with databases.

❑android.content The content API is used to manage data access and publishing by providing services for dealing with resources, content providers, and packages.

❑android.view Views are the core user interface class. All user interface elements are constructed using a series of Views to provide the user interaction components.

❑android.widget Built on the View package, the widget classes are the “here’s one we created earlier” user-interface elements for you to use in your applications. They include lists, buttons, and layouts.

❑com.google.android.maps A high-level API that provides access to native map controls that you can use within your application. Includes the MapView control as well as the Overlay and MapController classes used to annotate and control your embedded maps.

❑android.app A high-level package that provides access to the application model. The applica-tion package includes the Activity and Service APIs that form the basis for all your Android applications.

❑android.provider To ease developer access to certain standard Content Providers (such as the contacts database), the Provider package offers classes to provide access to standard databases included in all Android distributions.

❑android.telephony The telephony APIs give you the ability to directly interact with the device’s phone stack, letting you make, receive, and monitor phone calls, phone status, and SMS messages.

❑android.webkit The WebKit package features APIs for working with Web-based content, including a WebView control for embedding browsers in your activities and a cookie manager.

In addition to the Android APIs, the Android stack includes a set of C/C++ libraries that are exposed through the application framework. These libraries include:

❑ OpenGL The library used to support 3D graphics based on the Open GL ES 1.0 API ❑ FreeType Support for bitmap and vector font rendering

❑SGL The core library used to provide a 2D graphics engine

❑libc The standard C library optimized for Linux-based embedded devices

❑SQLite The lightweight relation database engine used to store application data

❑SSL Support for using the Secure Sockets Layer cryptographic protocol for secure Internet communications

Advanced Android Libraries

The core libraries provide all the functionality you need to start creating applications for Android, but it won’t be long before you’re ready to delve into the advanced APIs that offer the really exciting functionality.

Android hopes to target a wide range of mobile hardware, so be aware that the suitability and imple-mentation of the following APIs will vary depending on the device upon which they are implemented.

❑android.location The location-based services API gives your applications access to the device’s current physical location. Location-based services provide generic access to location information using whatever position-fixing hardware or technology is available on the device.

❑android.media The media APIs provide support for playback and recording of audio and video media files, including streamed media.

❑android.opengl Android offers a powerful 3D rendering engine using the OpenGL ES API that you can use to create dynamic 3D user interfaces for your applications.

❑android.hardware Where available, the hardware API exposes sensor hardware including the camera, accelerometer, and compass sensors as shown in Chapter 10.

android.bluetooth, android.net.wifi, and android.telephony Android also provides low-level

access to the hardware platform, including Bluetooth, Wi-Fi, and telephony hardware as shown in Chapter 10.

Summary

This chapter explained that despite significant advances in the hardware features available on modern mobile phones, the software available for them has lagged. A lack of openness, hard-to-use develop-ment kits, and hardware-specific APIs have stifled innovation in mobile software.

Android offers an opportunity for developers to create innovative software applications for mobile devices without the restrictions generally associated with the existing proprietary mobile development frameworks.

You were shown the complete Android software stack, which includes not only an application layer and development toolkit but also the Dalvik VM, a custom run time, core libraries, and a Linux kernel; all of which will be available as open source.

The Open Handset Alliance was introduced along with the responsibility that developers — as the pri-mary target audience for Android — have to create applications that will make consumers want Android phones on which to run them.

You also learned:

❑How handsets with an expanding range of hardware features have created demand for tools that give developers better access to these features.

❑About some of the features available to developers using Android, including peer-to-peer messaging, native map support, hardware access, background services, interprocess and inter-device messaging, shared databases, and 2D and 3D graphics.

❑That all Android applications are built equal, allowing users to completely replace one applica-tion with another, including the replacement of the core native applications.

❑That the Android SDK includes developer tools, APIs, and comprehensive documentation.

The next chapter will help you get started by downloading and installing the Android SDK and setting up an Android development environment in Eclipse.

You’ll also learn how to use the Android developer tools plug-in to streamline development, testing, and debugging before creating your first Android application.

After learning about the building blocks of Android applications, you’ll be introduced to the different types of applications you can create, and you’ll start to understand some of the design considerations that should go into developing applications for mobile devices.