Search code examples
androidtelephonymanager

Is there a way to know if phone have an active call?


I already tried TelephonyManager, PhoneStateListener. What I need is a method will return the current state of the phone.


Solution

  • While you used TelephonyManager & PhoneStateListener.

    Then you need to LISTEN_CALL_FORWARDING_INDICATOR.

    e.g:

    1- CALL_STATE_IDLE with value 0 and that's mean Device call state: No activity.

    2- OR CALL_STATE_RINGING with value 1 and that's mean Device call state: Ringing. A new call arrived and is ringing or waiting. In the latter case, another call is already active.

    3- CALL_STATE_OFFHOOK and that's mean Device call state: Off-hook. At least one call exists that is dialing, active, or on hold, and no calls are ringing or waiting.

    You may need to use READ_PHONE_STATE Permissions.