Sending AVRCP play command, getting spammed with broadcast
I have some hardware that sends the AVRCP play command to the phone upon bluetooth connection. What I am seeing is the MEDIA_BUTTON action intent spammed over and over in the debugger. This is causing problems with a few apps but mainly Pandora. Pandora will constantly play/pause over and over. It is almost like the AVRCP command gets sent to the phone which generates a MEDIA_BUTTON broadcast that keeps getting sent out over and over.
I set up a Broadcast Receiver to catch it and try to determine what's going on. Here is what is being spammed:
01-17 12:20:04.324: ERROR/NPT:(1558): Intent { act=android.intent.action.MEDIA_BUTTON (has extras) } 01-17 12:20:04.324: ERROR/NPT:(1558): KeyEvent{action=0 code=85 repeat=0 meta=0 scancode=200 mFlags=8}
which is the bluetooth Play/Pause media key. This is what it should be开发者_C百科, as the AVRCP command triggers this, but as I said, it's like the OS just keeps spamming this.
I have tried using the abortBroadcast()
method to stop it but that has
no effect. I am guessing the broadcast is non-ordered and can't be
stopped explicitly?
I have verified it is not the hardware spamming the AVRCP command by debugging my firmware code. The spamming behavior also continues if I unplug the hardware.
I am using 2.2.
Thanks.
This has been resolved. Turns out it was a problem with the hardware. I was sending the AVRCP play button down command but never sending the button up command. The phone was basically seeing this as the play button being "held down" so it kept sending the broadcast.
精彩评论