检测拨出电话是否已接听 [英] Detect if an outgoing call has been answered
问题描述
一旦ACTION_NEW_OUTGOING_CALL
被广播,我需要捕捉对方回答的以下事件.你能就如何实现这一目标提出建议吗?我知道这是可能的,因为 Android 拨号器应用程序会在他们接电话时将绿色的 Android 图标更改为该人的照片.
Once ACTION_NEW_OUTGOING_CALL
has been broadcasted, I need to capture the following event of the other party answer. Could you advice on how to achieve that please? I know it is possible as the Android dialer app changes the green Android icon to the person's photo exactly when they pick up.
更新:我查看了 Android 上处理拨出电话的应用程序的来源.我注意到 ContactsUtils
中的以下方法:
UPDATED: I've had a look at the source of the app on Android handling the outgoing calls. I noticed the following method in ContactsUtils
:
/**
* Kick off an intent to initiate a call.
*/
public static void initiateCall(Context context, CharSequence
phoneNumber) {
Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
Uri.fromParts("tel", phoneNumber.toString(), null));
context.startActivity(intent); }
我想我的答案是在侦听 Intent.ACTION_CALL_PRIVILEGED
的活动中.所以改写我的问题:有谁知道哪个活动处理 Intent.ACTION_CALL_PRIVILEGED
?
I guess my answer is in the activity listening for Intent.ACTION_CALL_PRIVILEGED
. So to rephrase my question: Does anyone know which activity handles Intent.ACTION_CALL_PRIVILEGED
?
推荐答案
我不认为有这样的 API,也没有用于发送 DTMF 的 API,原因与您无法分辨呼叫何时接通的原因相同.
I don't think there's such API and also there's no API for sending DTMFs due to the same reason that you can't tell when the call is being connected.
这篇关于检测拨出电话是否已接听的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!