wchorolque / osmtracker-android

Automatically exported from code.google.com/p/osmtracker-android
GNU General Public License v3.0
0 stars 0 forks source link

Always process push-to-talk key #211

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Start tracking, with a PTT headset connected
2. Go to map view or turn off the screen (at least some devices, including the 
Nexus S, continue to record high-quality logs with the screen off)
3. Press PTT

What is the expected output? What do you see instead?
Nothing happens, as PTT is only processes while the tracking screen is 
displayed - not in any other mode. It would be handy to have PTT functionality 
also in other modes - in map view or when tracking with the screen off. (In 
that case, the device should return to sleep after the recording finishes.) 
When other applications are in the foreground, things can be trickier - here, I 
guess it is best to make it configurable.

What version of the product are you using (See "About" screen)?

Make/model of your device, and Android version?
Nexus S running CyanogenMod 10

Please provide any additional information below.

Original issue reported on code.google.com by mich...@vonglasow.com on 20 Jan 2013 at 7:24

GoogleCodeExporter commented 9 years ago
Hm interesting... Not sure the PTT button can be processed while the device is 
sleeping, because I don't know who has the focus in this state...

Original comment by nicolas@guillaumin.me on 25 Jan 2013 at 4:06

GoogleCodeExporter commented 9 years ago
I have no idea how but it can definitely be done. For example I can 
pause/resume pandora using my headset button while the screen is off. Same with 
several other music players I have tried.

I think the really tricky part is what happens if you have multiple apps 
listening to it at the same time. Like if I'm playing pandora AND using 
OsmTracker at the same time. I have no idea what happens then :)

But yes, it would be really nice to be able to leave the screen off while I'm 
driving and just use the PTT button. Obviously there is the power consumption 
of the screen. The cops also can't see screen glow at night and pull you over 
for texting while driving :)

Original comment by toby.mur...@gmail.com on 25 Jan 2013 at 6:04

GoogleCodeExporter commented 9 years ago
I never really looked into how it's done, but the stock music player does it 
too. 

Searching on the net, I came across this:
http://android-developers.blogspot.de/2010/06/allowing-applications-to-play-nice
r.html

Generally, the last app to register is the first to get the event. Apps are 
expected to register and unregister in a responsible manner, that is, register 
when the user likely expects them to respond to button presses, and unregister 
when this is no longer the case.

So the question of how multiple apps should be handled becomes mostly a design 
question. I think the order should be:
1. Phone app (it probably inserts itself only when a call comes in and would 
thus be the first to receive the event anyway)
2. OSMTracker
3. Media players

The order for the last two can be configurable, e.g. by a PTT setting like:

Use push-to-talk button to control voice recording:
- Always
- Only when app is in foreground (i.e. in tracking view, in map view, but not 
when the screen is off or another app is in the foreground)
- Never

Original comment by mich...@vonglasow.com on 25 Jan 2013 at 11:20