android - 检测呼出电话是否已被接听

标签 android android-intent telephony

ACTION_NEW_OUTGOING_CALL 广播后,我需要捕获对方应答的以下事件。你能就如何实现这一目标提出建议吗?我知道这是可能的,因为 Android 拨号器应用程序会在他们接听时将绿色的 Android 图标更改为该人的照片。

更新:我查看了 Android 上处理拨出电话的应用程序的源代码。我在 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 的 Activity 中。所以换句话说我的问题:有谁知道哪个 Activity 处理 Intent.ACTION_CALL_PRIVILEGED

最佳答案

我认为没有这样的 API,也没有用于发送 DTMF 的 API,原因与您无法判断调用何时接通的原因相同。

关于android - 检测呼出电话是否已被接听,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9513644/

相关文章:

android - 我是否正确使用 flatMap 来合并来自多个 API 调用的结果?

java - ListView Intent On Item Click Listener 停止应用程序错误

android - 在特定时间启动 Activity

Android 接收短信 Intent : Get Message Id or Thread Id

android - 按父行调整列自动高度

android - 由于 OTA 更新到 Marshmallow,我基于陀螺仪的应用程序不再工作

java - 这个小Java程序中的错误

android - 如何在设备方向改变时停止再次调用 Activity?

speech-recognition - 使用 Twilio 之类的语音 + 电话 API(文本到语音和语音到文本)以编程方式通过电话接受信用卡?

java - 如何在 PCI 调制解调器上有来电时获取电话号码