A
A
Alexey Grichenko2011-01-17 08:14:23
Android
Alexey Grichenko, 2011-01-17 08:14:23

Android programming question?

I decided to try to write a program for the subject, which itself would answer calls with a headset connected (I know that there are already such, but they do not quite suit me). After a long digging in Google, I found out that the only way to answer a call programmatically is to emulate pressing a button on the headset (ACTION_MEDIA_BUTTON + KEYCODE_HEADSETHOOK). Basically, it works. That is, he answers the call.
But then another problem surfaced: the same button starts the audio player. And I don't see any way to kill him. I tried to set different privileges when emulating pressing - it still starts, you bastard.
I saw examples somewhere using internal telephony classes (Phone, etc.), but they seem to be missing in 2.x.
Maybe someone knows how to deal with this, or offer an alternative way to answer an incoming call?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question