0

I try to get default dial pad call disconnect button click for get call state Ex: Active, disconnecting , disconnected and ect..

I need call state without using InCallService class .Because IncallService class only response for Custom dial app. May you help me for Suitable answer. Thank you

Kabilan
  • 191
  • 10

1 Answers1

-1

It sounds like you may want to look at the Android PhoneStateListener class:

Assuming you are in an active call you will see the state change to idle when the user ends the call by hitting the call disconnect button.

public void onCallStateChanged(int state, String incomingNumber) {

            switch (state) {
                case TelephonyManager.CALL_STATE_IDLE:
                    break;
                case TelephonyManager.CALL_STATE_RINGING:
                    break;
                case TelephonyManager.CALL_STATE_OFFHOOK:
                    break;
            }
        }

Check that you have permissions for the particular info you need:

Note that access to some telephony information is permission-protected. Your application won't receive updates for protected information unless it has the appropriate permissions declared in its manifest file. Where permissions apply, they are noted in the appropriate LISTEN_ flags.

If you want to actually intercept the button click and do something other than end the call, this is not supported AFAIK.

Mick
  • 24,231
  • 1
  • 54
  • 120
  • Thanks for your answer. But i need proper active,disconnected,disconnecting and end . without. – Kabilan May 15 '20 at 06:35
  • Thanks for your answer. But i need proper active,disconnected,disconnecting and end . without using InCallService. You answer only give three states . And i also spend 3 to 4 days for state finding work. but not able to find – Kabilan May 15 '20 at 06:51