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.
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.
AndroidManifest.xml
You need to add READ_PHONE_STATE uses permission in this xml file. Let’s see the full code.
Output:
Run it on the actual device like mobile phone and make call to this from another mobile, then you will listen the incoming number.