kiran
kiran

Reputation: 3264

How to get exact outgoing call receiving time?

I am new to android.

I am implementing one application related to incoming and outgoing call details.

I am getting outgoing call and incoming call details by using brodcast receivers.

The problem is when the incoming call will come the brodcast receiver will rise,

And i make an outgoing call the brodcast receiver raised.

That is fine,but when i click the green button the outgoing call will start,but

i want exact time of answering the call from otherside.

How i get this?

If any one know please help me.

Thanks in advance.

Upvotes: 1

Views: 3328

Answers (2)

5hssba
5hssba

Reputation: 8079

Continuously check when device state is changed from CALL_STATE_IDLE, to CALL_STATEOFFHOOK... It gives the exact time of your call being answered

Upvotes: 1

user936414
user936414

Reputation: 7634

Try using a TelephonyManager

if ((intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL) || (intent
                .getAction()
                .equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)))) {

            String phoneState = intent.getExtras().getString(
                    TelephonyManager.EXTRA_STATE);
            if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
                Log.d(TAG, "Outgoing call");

            if (TelephonyManager.EXTRA_STATE_OFFHOOK.equals(phoneState)) {
                Log.d(TAG, "Incoming call/Outgng call Started");

            }
            if (TelephonyManager.EXTRA_STATE_IDLE.equals(phoneState)) {
                Log.d(TAG,"Call ended");
            }
            if (TelephonyManager.EXTRA_STATE_RINGING.equals(phoneState)) {
                Log.d(TAG,"Call ringing");
            }
        }

Upvotes: 2

Related Questions