Chapter 15. Telephony State Information and Android Telephony Classes

The previous chapter showed how to use Android’s built-in PhoneApp application, which simplifies the task of placing of phone calls. This chapter shows you how to get more information about telephone service and the actual calls you make.

After an example that puts one of the telephony features to use, we’ll present a short guide to PhoneApp internals.

Note

We use the term “telephony” to refer to the parts of the Android system that depend on a radio communicating with the public land mobile network (PLMN) to provide communication and location functions. Sharing the use of this radio among multiple applications is a key goal for Android’s telephony modules.

Operations Offered by the android.telephony Package

The android.telephony package contains a set of classes that can be used by any application in the Android environment to monitor the state of Android’s mobile network connection. It also contains classes for locating a device using the mobile network. Finally, it offers utility classes for parsing, formatting, and otherwise managing phone numbers, although there is no architectural benefit to locating those classes in this package.

The telephony package does not allow you to place, end, or otherwise meddle in phone calls; it focuses on retrieving information and giving users an interface to edit telephone numbers. We’ll explain later why Android reserves the actual control over phone calls to PhoneApp.

Package Summary ...

Get Android Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.