简体   繁体   English

是否有任何Android API可以记录通话对话和/或自动接听电话?

[英]There is any Android API to record call conversation and/or automatically answer calls?

Scanned through the Android API (reference) documentation, but didn't find specific API that allows one to achieve the following: 浏览了Android API(参考)文档,但未找到允许实现以下目标的特定API:

  1. Be notified of an incoming call 收到来电通知
  2. Automatically answer or reject the incoming call 自动接听或拒绝来电
  3. While a call is in progress, be able to capture the audio 在通话过程中,可以捕获音频
  4. Play a pre-recorded message, after answering the call 接听电话后播放预先录制的信息

The intention behind the questions, as most might have guessed, is to have an automated answering machine type of application. 大多数人可能已经猜到了,这些问题背后的目的是要有一种自动答录机类型的应用程序。 I have seen such applications on Nokia Symbian OS devices. 我在诺基亚Symbian OS设备上看到过这样的应用程序。

If such functionality requires rooting the device, I'd still be interested in knowing the API's available once rooted! 如果此类功能需要植根设备,我仍然想知道植根后该API可用!

As an aside, is there are separate API reference documentation for API's available to rooted devices ? 顺便说一句,是否有针对根设备可用的API的单独API参考文档?

For the latter parts of your question, No. 对于您问题的后半部分, 否。

Imagine for a second there was, and you had an app installed that uses it. 想象一秒钟,您已经安装了使用它的应用程序。 It could record your conversations and send them to a 3rd party. 它可以记录您的对话并将其发送给第三方。 The app might not even disclose that it does this. 该应用程序可能甚至没有透露自己这样做。

That sounds like it would be a huge security problem... Don't you agree? 听起来这将是一个巨大的安全问题……您不同意吗?

It would appear I am mistaken about the call recording part - several apps available on google play (such as this , this , and this ) does call recording, at least of the user making the call. 似乎我对通话记录部分误解了-谷歌播放中可用的几个应用程序(例如thisthisthis )确实进行了通话记录,至少是拨打电话的用户。

For #1, this is covered by marcin_j's answer 对于#1,这是marcin_j的答案所涵盖

For #2, these SO answers show you can accept or reject a call programmatically. 对于#2,这些SO答案表明您可以以编程方式接受拒绝呼叫。

For #3, I did a bit more detailed search on this, which reveals a related Stackoverflow question and answer , which provides info on recording audio (as per the above linked apps). 对于#3,我对此进行了更详细的搜索,显示了相关的Stackoverflow问题和答案 ,该问题和答案提供了有关录制音频的信息(根据上述链接的应用程序)。 Please keep in mind there are likely legal requirements around recording calls. 请记住,录音通话可能有法律要求。

For #4 (playing a message to the caller), the only info I was able to find on this says it is not supported . 对于#4(向呼叫者播放消息),我唯一能找到的信息说不支持 It's hard to find much more info on this with so much clutter on search coming up with apps that are basically an audio version of caller id. 很难找到更多有关此方面的信息,而且搜索时会出现很多混乱,而这些应用基本上都是来电显示的音频版本。

Most of these answers are on StackOverflow already; 这些答案大多数已经在StackOverflow上了; hopefully bringing it all together here helps you. 希望将所有内容整合到这里对您有所帮助。

  1. You can use android.intent.action.PHONE_STATE broadcast, and check TelephonyManager.CALL_STATE_RINGING state. 您可以使用android.intent.action.PHONE_STATE广播,并检查TelephonyManager.CALL_STATE_RINGING状态。 Requires android.permission.READ_PHONE_STATE . 需要android.permission.READ_PHONE_STATE

2/3. 2/3。 Dont think you can do this, at least not on non-rooted phones. 不要以为您可以做到这一点,至少不能在非root用户的手机上做到。 Maybe someone else will give better answer. 也许其他人会给出更好的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM