How to get exact outgoing call receiving time?

前端 未结 2 1223
生来不讨喜
生来不讨喜 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: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");
                }
            }
    

提交回复
热议问题