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/2250455/

相关文章:

android-sdk/tools/ant/build.xml :698: null returned: 1

android - 为什么 WebView 比 TextView 快这么多

android - 让 Android 应用程序在重启时自动启动

java - Intent 并不总是按预期工作

android - 发生某些事件时将电话状态更改为响铃

android - 使用 Jsoup 从 php 中提取文本结果是一个空的 textView

android - 如何在安卓手机中捕捉手指运动方向?

android - 使用单击事件以编程方式在android中创建按钮

Android - 向范围内的所有手机信号塔发送回声请求

android - 使用sendMultimediaMessage发送和读取MMS