How to get android default dial pad call disconnect button click event

188 Views Asked by At

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

1

There are 1 best solutions below

1
On

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.