Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android-Telephony application that keeps focus on incoming calls

I am developing a custom telephony application that is able to receive calls. Using this code for handling the incoming call https://code.google.com/p/auto-answer/source/browse/trunk/src/com/everysoft/autoanswer/AutoAnswerIntentService.java

Unfortunately my app loses focus on the incoming call.

THIS was a partial solution for outgoing calls Android- Telephone app that keeps focus on outgoing & incoming phoneCall

What about incoming calls? How do I keep focus in my custom app?

I am guessing this might involve downloading and modifying the source code as simply accessing the SDK gives little control over the built-in phone application.

like image 700
Bachalo Avatar asked Nov 10 '22 15:11

Bachalo


1 Answers

Since the reference you made about outgoing calls is acceptable, then you can place an activity in front of the incoming call screen shortly after it displays. The difficulty in doing this is that the call state will change to "RINGING" and then also "OFFHOOK" but the phone has not displayed the InCallScreen when these are broadcast.

Like the post you referenced, this solution does not actually embed the phone feature into the app (like a webview for web browsing) but rather places an activity in front of the InCallScreen shortly after it displays.

For incoming calls, you need to delay the launch of your activity, like in this post:

Android - Customised New Incoming Call Screen

You can put anything on the screen at the point, the hard part is determining the lag time so that it meets your needs (slow enough so that the InCallScreen has a chance to launch but fast enough to be minimally disruptive).

Beyond that, even extending AOSP will not help unless you have access to each physical device where this will be used to root them or put a custom build on them. Access to the PhoneApp features is not accessible to non-system apps (the com.android.phone package).

like image 121
Jim Avatar answered Nov 14 '22 22:11

Jim