Search code examples
javaandroidmobilephone-callincoming-call

How to get more information on incoming call


I have set up my virtual phone numbers to forward calls on my cell phone. When the call is forwarded, I am receiving the incoming number, but not what number they dialed us to reach.

Is it possible to get the number they dialed us to reach?

public class MyPhoneStateListener extends PhoneStateListener {
  private String[] projection = new String[] {
    People._ID, People.NAME, People.NUMBER
  };
  public void onCallStateChanged(int state,String incomingNumber){
    switch(state)
    {
      case TelephonyManager.CALL_STATE_IDLE:
        Log.d("DEBUG", "IDLE");
      break;
      case TelephonyManager.CALL_STATE_OFFHOOK:
        if(!incomingNumber.equals("")){
          handleCall(incomingCall);
        }
      break;
      case TelephonyManager.CALL_STATE_RINGING:
        Log.d("DEBUG", "RINGING");
      break;
    }
  }

Solution

  • From what I have learnt, it is only possible to get the incoming number.