Hello All
I am having trouble with the android.intent.action.MEDIA_BUTTON intent receiver. I have attached a simple project, please have a look.
What I want to achieve:
Detect that the button on the headset is being pressed for more than 3 seconds.
What does work:
When the button on the headphone is pressed, one short click only, the intent is received, both for ACTION_DOWN and ACTION_UP.
The problem:
When the button is pressed and not released, Google pops up (or any other app that is registered as a 'requestAudioFocus' receiver) and after that single clicks are not received. Also when a long press is being done the initial ACTION_DOWN event does not occur.
What the app currently does:
When the app launched it start a service that requests 'android.media.AudioManager.OnAudioFocusChangeListener', when the event that is associated with it is fired, it call RegisterForMediaButton which
@Erel says needs to be done.
All help would be appreciated. I have an old HTC ONE V phone and it works perfect on it. I also have a Sony Xperia (D2203) which show up the problem.
Thanks for reading this I hope you all can help with this as I think it will benefit everyone.
Regards
John.
@lemonisdead
@stari