labexp / osmtracker-android

GPS tracking tool for OpenStreetMap
GNU General Public License v3.0
502 stars 236 forks source link

Pressing a headset media button should start recording voice #60

Open hatzfeld opened 8 years ago

hatzfeld commented 8 years ago

Feature request: The app should have this configurable (!) feature:

When a media button of a connected bluetooth headset device is pressed, the app should start voice recording (for the configured time or until the button is pressed again), preferable using the microphone of the headset. (This seems to work already on a wired headset, but not with bluetooth.)

From efforts made by the authors of osmand I know that this is tricky: Different bluetooth headsets cause different intends in different moments; thus the app must be configurable in a way that allows to switch this feature off (which should be the default) and to select the signals to react to.

The feature itself will be very useful when mapping by car or bike in countries where you are not allowed to touch a smartphone while driving.

nguillaumin commented 8 years ago

Hi, yeah it does that with a wired headset already, but I have no idea how to do that with a bluetooth one. I'd happily take a pull request for it ;)

MigoMueller commented 4 years ago

I realize this is an old issue, but could you please elaborate on that:

yeah it does that with a wired headset already

Does it mean that I can get OSMtracker to record a voice note without touching the phone, just by pushing a button on the headset (provided it's wired)? That would be great! I like audio-mapping on the bicycle. It's just that taking out the phone while riding is clumsy, unsafe, and illegal in most jurisdictions. Pushing a little button would be much safer.

I couldn't find this capability mentioned anywhere, just here, that's why I'm asking.

I'll be happy to test this and to help document it. Just let me know if there's a chance that it works at all.

W-rob commented 3 years ago

I use OSMTracker a lot, and would use it more on the bike, but before I go out and get a microphone that will fit near my mouth, I'd also like to know precisely how the facility to initiate recording from an external button is achieved. I always have the duration set to 30s but I usually cut this short each time by pressing "stop" on the screen. Will pressing the microphone button a second time end the recording or will it run the whole 30s? What's needed to set it all up or does it "just work"? I'd really appreciate some enlightenment please. Thanks.

holubp commented 3 years ago

I have the same situation here - used to use OSMTracker a lot for the audio notes in the times when phones had jack for normal analog headset and the mic button worked nice in OSMTracker. Now I am limited to either USB or BT headsets and none works. The buttons always starts/stops audio player (AIMP in my case).

Would it be possible to register OSMTracker as audio player (ideally only when recoding) and let it react to play/pause signals from Android?

smootheFiets commented 3 years ago

Starting and stopping an audio recording works just fine for me using a cheapo headset w/ jack cable. This way, I can safely record audio messages without stopping the bike, without touching the phone, with gloves on. That's a very efficient way to survey, which has definitely improved my OSM life.
Downside: the phone must not be on lock screen. I keep the screen from locking while OSMtracker is on ("smart lock", "on-body detection"), which is not ideal but OK for me. Too bad that Bluetooth headphones don't seem to work the same way!

holubp commented 3 years ago

@smootheFiets: Indeed, this is what I have mentioned in my report too - using simple analog headset with the button works fine. But it does not work with USB nor BT headsets - and the problem is that many newer phones do not have jack anymore. However, the USB/BT headset can reliably launch AIMP (play/pause), so if OSMTracker could behave as a media player and respond to these actions while recording a track, it might have worked even with those headsets.

mnalis commented 3 years ago

See also https://github.com/labexp/osmtracker-android/issues/71 for enabling taking an audio note when screen is locked.

mnalis commented 3 years ago

@holubp well, USB-C wired headset button works just fine for me in OSMTracker 1.0.1 on Android 10 phone (Huawei P30 Pro) to record audio note. The app does have to be in foreground with screen does on, unfortunately (although it should be possible to fix that - see issue https://github.com/labexp/osmtracker-android/issues/71)