Android: detecting outgoing call pickup

I've been very busy programming an app on Android lately. It's an emergency app - one that enables someone in distress to make an emergency call as well as reporting the situation to a monitoring server, which then notify pre-defined parties so they can take action to help.

It is a very interesting experience, and quite challenging. This is too much to tell in just one blog post, so I'll probably spread it over a few posts as time allows. Or I'll follow up with some articles.

To begin with, please remember two facts: Android, as a platform, is 9 years old as of now. It was also a platform originally designed to serve as base for smartphones. So, I expected that they would have straightened out all the kinks in it; and have good support for telephony functions.

It turns out that it doesn't.

For example - there is no function, or event, whatsoever, to detect that an outgoing call has been picked-up by the remote party. Sure, the Android's own phone application knows this, but this knowledge for some reason is not disseminated to others. In Android 5+ you can get this information, but only if you are a "system" app. Most applications are *NOT* system app, because, well, to be able to install as a system app, you need to root your device first. So this isn't a solution you can apply generally. Stack Overflow is full of questions about this for many years, with no good answer until today. There isn't any improvement from Google as well to add this feature (I'm quite sure that a few Google engineers are watching Stack Overflow).

But I *need* this ability to detect remote pickup, because, well, in my application, if the outgoing call is not answered in a certain time, I would need to terminate the call and call another number. What to do?

I solved it by detecting the ring-back tone. As long as the call has not been picked-up, the ring-back tone will be heard. If the ring-back tone is no longer heard after certain time (and call is still on-going), we can assume the call has been picked up.

Posted on 17 Jun 2016, 03:04 - Categories: Android
Edit - Delete


Comments:

Posted on 27 Sep 2016, 07:06 by starlogi
"RBT"
Hi ... How do you detect the ringbacktone?
Delete



Add Comment

Title
Author
 
Content
Show Smilies
Security Code 5920105
Mascot of Fatdog64
Password (to protect your identity)