Javatpoint Logo

91-9990449935

 0120-4256464

Android Simple Caller Talker Example

Android provides the facility to know the incoming number and speak it by the help of android speech api and telephony manager.

Here, we are going to develop a basic android app that speaks the incoming number while phone is in ringing mode.

In the next page, we will see the full version of this app that speaks the caller name and provides the setting option to change the speed rate and pitch. Additionaly, it provides option to add text before and after the incoming number or caller name.

activity_main.xml

We have not done anything special here. It has the simple textview.

File: activity_main.xml

Activity class

In this activity, we have written the code to know the phone state, and speak the incoming number by the help of TextToSpeech class.

File: MainActivity.java

AndroidManifest.xml

You need to add READ_PHONE_STATE uses permission in this xml file. Let's see the full code.

File: AndroidManifest.xml


Output:

android caller talker example output 1

Run it on the actual device like mobile phone and make call to this from another mobile, then you will listen the incoming number.