Android Jelly Bean introduced a voice search which activates with a long-press on the play/pause button of a headset. As my app requires being able to utilise these long-presses, I was wondering if there is any way to either disable the voice search or make Android play fair with the button events.
I have not tried it myself, but you may be able to get this to work using the AudioManager's registerMediaButtonEventReceiver method, as the volume buttons are media buttons.
The AOSP music app has a MediaButtonIntentReceiver that responds to volume button presses.
Credit for this solution belongs to this answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With