Knowledge on Android Studio Coding

Hello There,

A while ago I started working on a project of mine with both Arduino and Android (App to interact with the Arduino circuit). I want help with the Android Studio since am new in that section. I manage to establish a connection with the Arduino that has a Bluetooth module and an LCD. I can send text from the phone and get it on the LCD.

My question is: I want to print the phone number of the incoming call when someone is calling me to the Arduino's LCD. How can I get the phone state and from there the incoming phone caller number? I want to get it and then print it on the LCD (As am planning for my project)

I search the net but I didn't find much of results. Is that possible to achieve? If yes is there anyone who can guide me?

Many Thanks,

Nikolaos Konstantinou (NcCon)

Incoming Android Number

Never tried that before, but the right keyword search seems to give some hints. Hopefully something here will get you on the right track and others here might have suggestions / ideas.

https://developer.android.com/reference/android/telephony/PhoneStateListener

https://stackoverflow.com/questions/1853220/retrieve-incoming-calls-phone-number-in-android 

https://stackoverflow.com/questions/13154445/how-to-get-phone-number-from-an-incoming-call

 if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)){
Log.e(TAG, “Inside EXTRA_STATE_RINGING”);
String number = arg1.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
Log.e(TAG, "incoming number : " + number);
}