1

Scanned through the Android API (reference) documentation, but didn't find specific API that allows one to achieve the following:

  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.

If such functionality requires rooting the device, I'd still be interested in knowing the API's available once rooted!

As an aside, is there are separate API reference documentation for API's available to rooted devices ?

jay
  • 203
  • 3
  • 7

2 Answers2

4

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.

For #1, this is covered by marcin_j's answer

For #2, these SO answers show you can accept or reject a call programmatically.

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). 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. 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; hopefully bringing it all together here helps you.

Community
  • 1
  • 1
Krease
  • 15,805
  • 8
  • 54
  • 86
  • While I agree and understand the potential security problems, but isn't it possible for a application to be certified by a trusted 3rd party, to use such API's for legitimate applications ? SymbianOS, I believe had such an approach to API's that could potentially be misused for malafide reasons. – jay Jan 12 '14 at 08:08
  • Did some further research - I was originally looking for a definitive "no" source, but instead found the opposite, so I completely updated my answer. – Krease Jan 12 '14 at 08:36
  • Would've done a double-upvote if I could. The updated answer is really appreciated. Thanks for linking the existing SO answers. I've been doing my own research after posting the question, and it seems some of the capabilities have evolved over time, i.e. from 2.3.x times to Kit-kat, including available APIs. Will wait a day or so, before accepting. – jay Jan 12 '14 at 09:09
  • 1
    [This](https://play.google.com/store/apps/details?id=com.elpis.answer_machine&hl=en) app on Google Play store seems to attempt some crude mechanism, also discussed in the SO QnA you link, i.e. use load-speaker to play audio, with the mic picking it up. Also the QnA explains why playing back audio may not be possible! – jay Jan 12 '14 at 10:26
1
  1. You can use android.intent.action.PHONE_STATE broadcast, and check TelephonyManager.CALL_STATE_RINGING state. Requires android.permission.READ_PHONE_STATE.

2/3. Dont think you can do this, at least not on non-rooted phones. Maybe someone else will give better answer.

marcinj
  • 48,511
  • 9
  • 79
  • 100