KeyEvent.KEYCODE_MEDIA_NEXT not received unless audio is playing
I've paired with a Bluetooth headset. When audio is playing, KeyEvent.KEYCODE_MEDIA_NEXT
and KeyEvent.KEYCODE_MEDIA_PREVIOUS
are received fine in my BroadcastReceiver
. When audio is not playing, my receiver does not get called for these key events.
In this same state, when audio is not playing, this same receiver is called for play/pause, KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE
, so I know this is not an issue of my receiver not being registered.
Once audio does begin to play, I can see via logs that while audio was not playing, all KeyEvent.KEYCODE_MEDIA_NEXT
events were queued, and are re-delivered once a开发者_运维技巧udio starts. Each of these events is delivered with KeyEvent.ACTION_DOWN.
Is this normal behavior? Do Bluetooth next and previous buttons only function when audio is playing?
I have met the same issue with one pair of headphones. But when I tried another pair of headphones my BroadcastReceiver received KEYCODE_MEDIA_PREVIOUS and KEYCODE_MEDIA_NEXT, when audio was NOT playing. So it seems that the issue depends on the headphones you're using.
精彩评论