如何获得确切的去电接听时间? [英] How to get exact outgoing call receiving time?
问题描述
我是android的新手.
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.
我怎么得到这个?
如果有人知道,请帮助我.
If any one know please help me.
谢谢.
推荐答案
尝试使用TelephonyManager
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");
}
}
这篇关于如何获得确切的去电接听时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!