Android: ¿cómo detectar que se presionó el botón rojo en la pantalla táctil durante una llamada?

I would like to know if there is the possibility that my APP can notice when I clicked the red button (accidentally or not) to end a call. I have an APP running in background that can track the incoming number of the phone at the moment that I receive a call and while doing the call.

As the "red button" to end a call is not a hardware button in the touch screen phones, I'm struggling trying to know how to detect when I pressed that button. And I'm starting to think that is not really possible.

I have searched and I found that there are ways to know the position that your fingers are touching in the screen while running your APP, (I don't know if this is possible when your APP is running in background) but as every android phone has a different shape and form of hanging up a phone call this is not a possible solution for my problem.

preguntado el 09 de marzo de 12 a las 13:03

you're thinking way too complicated, see Akhil's answer below. -

i know it's complicated that's why I'm trying to ask if somebody found out how to detect when you press the "red button" in the touch screen so I can be sure that was the user of the device who ended the call. -

1 Respuestas

You can find out when the user hangs up a phone by implementing a BroadCast Receiver listening to phone state. When the state becomes Idle after either ringing state or offhook state, you can get to know the call has ended. If you just want to know when the call ends this method would work fine.

respondido 09 mar '12, 14:03

I know about the BroadCast Receiver and the possibility to know the three states of the phone "idle", "ringing" or "off hook", and how to implement that so you know when the device is in a phone call ornot. But my wish was to know exactly if the call was ended by the user of the phone. - user1259285

I don't believe it's possible to determine que ended the call, just that the call has ended. - Matt K

yup, even I don't think it is possible - Akhil

as I didn't succed with this "red button" stuff I was thinking in detect if somebody has touched the screen (wherever of the screen) during a call, so you see the interface of the call and your app is running in background. do you think that may be possible? because I implemented how to detect where the user touched the screen while your APP is running in foreground, but not when it is in background.... - user1259285

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.