O'Reilly logo

Pro Android 4 by Satya Komatineni, Dave MacLean

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with the Telephony Manager

The telephony APIs also include the telephony manager (android.telephony.TelephonyManager), which you can use to obtain information about the telephony services on the device, get subscriber information, and register for telephony state changes. A common telephony use case requires that an application execute business logic on incoming phone calls. For example, a music player might pause itself for an incoming call and resume when the call has been completed. The easiest way to listen for phone state changes is to implement a broadcast receiver on android.intent.action.PHONE_STATE. You could do this in the same way we listened for incoming SMS messages earlier. The other way is to use TelephonyManager.

In this ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required