How to get exact outgoing call receiving time?

前端 未结 2 1204
生来不讨喜
生来不讨喜 2021-01-25 00:55

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 usi

相关标签:
2条回答
  • 2021-01-25 01:49

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

    0 讨论(0)
  • 2021-01-25 01:50

    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");
                }
            }
    
    0 讨论(0)
提交回复
热议问题