Android began as a platform for cellular telephone handsets, so it is no surprise that Android apps are very capable of dealing with the phone. You can write apps that dial the phone, or that guide the user to do so. You can write apps that verify or modify the number the user is calling (e.g., to add a long-distance dialing prefix). You can also send and receive SMS (Short Message Service) messages, a.k.a. text messages, assuming your device is telephony-equipped. Nowadays, a great many Android tablets are WiFi-only, and do not have 3G or even 2G telephone/SMS capabilities. For these devices, other capabilities such as SMS via the Internet and VoIP (Voice over IP, usually SIP) have to be used.
This chapter covers most of these topics; a few are discussed elsewhere in this book.
You want to act on an incoming phone call and do something with the incoming number.
You can implement a broadcast receiver and then listen for
If you want to do something when the phone rings you have to
implement a broadcast receiver, which listens for
intent action. This is a broadcast intent action indicating that the
call state (cellular) on the device has changed. Example 12-1 shows the code for the incoming call interceptor, and ...