henryadamsjr / media-button-router

Automatically exported from code.google.com/p/media-button-router
Apache License 2.0
0 stars 0 forks source link

Disable media buttons for short period right after bt connection established #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Purpose:
To provide cleaner experience to users who are using app to primarily stop car 
bluetooth auto-connect from blasting them with music

Good number of comments on market about how people are using media button 
router to stop their cars from playing music automatically. Some feature 
requests are even just for media buttons to do *nothing*. Apparently some 
bluetooth devices will send a play media button event after they bt sync (which 
can happen automatically). This causes music to play right away when you get in 
the car and is annoying. There's also a lot of comments on bluetooth issue on 
android about same thing. 

Enhancement:
Have a "saftey" that is activated for x seconds after a bluetooth connection 
occurs. If the device receives a media button event soon after bluetooth 
connection is established just flat out ignore it and do nothing.

Original issue reported on code.google.com by harleens...@gmail.com on 3 Jul 2011 at 3:45

GoogleCodeExporter commented 9 years ago
This could be refined to only blocking the play media button since that's 
probably the only one that's being sent on connection established. I don't have 
a device that exhibits this behavior so kind of limited in testing and figuring 
out exactly what's going on.

Here's what I think the basic implementation will be:
1. Add another broadcast receiver for bt connect intent, make sure it is an bt 
audio intent, not bt phone. Record time of connect in some shared storage 
(sharedprefs?)
2. In media button receiver, have check at top of code that checks if it's a 
play and then checks the current time against the time recorded for bt audio 
connect. If't is too soon after, just return to ignore it. may have to make 
sure wherever we're recording the time handles concurrently. Once bt play up 
and down keys are blocked, disable saftey by clearing out time. (I doubt any 
device is spamming play requests on connect and don't want to block legitimate 
user initiated play)
3. Add "safety" preference to preferences page that enables this feature. Make 
this feature completely independent of enabling and disabling of media button 
router. Some users may want only this feature.

Original comment by harleens...@gmail.com on 3 Jul 2011 at 3:54

GoogleCodeExporter commented 9 years ago
also make sure to spell safety right..

Original comment by harleens...@gmail.com on 3 Jul 2011 at 3:56

GoogleCodeExporter commented 9 years ago
I have seen this behavior on the base model head units of 2012 and 2013 Toyota 
4Runner.  Even more annoying, the head units send a play button press when a 
phone call ends, so if a "ignore play button press after phone call ends" 
option were added that would be amazing!

Original comment by drmatth...@gmail.com on 6 Nov 2012 at 1:03