Closed GoogleCodeExporter closed 9 years ago
Interesting... Unfortunately I'm not very familiar with the code since it was
contributed by somebody else.
AntennaPod seems to be open source so there might be some clues in there:
https://github.com/danieloeh/AntennaPod/
Original comment by nicolas@guillaumin.me
on 20 Jan 2015 at 10:36
I suspect it's priority related, after having read:
-
http://android.stackexchange.com/questions/13620/what-determines-which-applicati
on-acts-to-a-bluetooth-avrcp-command
- https://code.google.com/p/media-button-router/
- https://groups.google.com/d/msg/android-developers/494TKtLrD2U/UfJ7pc2tWUYJ
-
http://android-developers.blogspot.com.au/2010/06/allowing-applications-to-play-
nicer.html
So there doesn't seem to be a "proper" fix... Perhaps, according to this last
blog post, removing the MEDIA_BUTTON intent in the manifest, but keeping the
registerMediaButtonEventReceiver() call would cause it to react to the button
only when the app. is in foreground?
Original comment by nicolas@guillaumin.me
on 20 Jan 2015 at 10:45
Looking at AntennaPod's code, they also have the MEDIA_BUTTON intent defined in
the manifest:
https://github.com/danieloeh/AntennaPod/blob/9659c18d899349d9be1573fb9520defc7d3
a19cd/core/src/main/AndroidManifest.xml#L31
However, the difference I've seen is that osmtracker defines that intent with a
priority of 10000, which I assume is a high priority that overrides the others.
Might removing that priority solve this issue?
https://github.com/nguillaumin/osmtracker-android/blob/6c1eb906a137aef821e188497
bf0742fe854cbbb/AndroidManifest.xml#L49
From the Android documentation
https://developer.android.com/guide/topics/manifest/intent-filter-element.html
Use this attribute only if you really need to impose a specific order in which
the broadcasts are received, or want to force Android to prefer one activity
over others.
The value must be an integer, such as "100". Higher numbers have a higher
priority. The default value is 0. The value must be greater than -1000 and less
than 1000.
I'd thus suggest removing the priority.
If you want to create a temporary .apk, I'm willing to test and let you know if
this solved the problem.
Original comment by emil...@klein.st
on 20 Jan 2015 at 11:56
If we remove the priority it goes back to zero I guess, how can we be sure that
the PodCast app. will take precedence if they're both at zero?
That might fix this specific case, but that wouldn't work with other apps that
set a negative priority for instance. That's why I thought it would be neat to
find a solution that works everywhere such as catching the event only when
OSMTracker is in the foreground (assuming that works).
That being said it's probably worth testing removing the priority to see if
that helps...
Original comment by nicolas@guillaumin.me
on 21 Jan 2015 at 8:12
Prior to osmtracker implementing this feature, if I pressed the media button
when AntennaPod was not running, nothing would happen. So it looks like
AntennaPod has found a way to only handle the call when it is not running.
Might it be that with a high priority, Android itself keeps track of that and
wakes the app up, as it is "so important"?
Let's see what happens when the priority is removed.
Original comment by emil...@klein.st
on 21 Jan 2015 at 8:41
Hi Nicolas, any possibility you'd create an .apk with the priority removed, so
that I can test it out?
Original comment by emil...@klein.st
on 28 Jan 2015 at 2:29
Sure, attached.
Note that you'll need to enable a developer option to be able to install this
unsigned APK, and it's likely you'll have to uninstall it when switching back
to the official version so there's a risk you'll be loosing your tracks... Make
sure you backup everything!
Thanks.
Original comment by nicolas@guillaumin.me
on 28 Jan 2015 at 11:10
Attachments:
Issue 260 has been merged into this issue.
Original comment by nicolas@guillaumin.me
on 4 Feb 2015 at 8:22
Thanks for the test .apk Nicolas.
I have installed it, and the incorrect starting of OSM doesn't occur anymore.
Note that I had not tried to use the actual push-to-talk feature in OSM before,
so I'm not really sure how/when it should work. I've tried running the
application (from the test .apk), recording a track, got the GPS fix, then
locked the phone/shutting down the screen, turned it back on, and long-pressed
the home button. That didn't result in a voice-memo being taken though.
As far as I'm concerned, this is fixed (not starting while I'm running my
podcast app) but I'm not sure if this feature still works as supposed to.
On Github I have asked zdila, who added this feature, to comment on this issue.
Original comment by emil...@klein.st
on 4 Feb 2015 at 8:53
Cool thanks for testing! I'll wait a bit for zdila comment and release it soon
Original comment by nicolas@guillaumin.me
on 4 Feb 2015 at 8:54
I can confirm the APK has also fixed the issue (260) I was having on my Xperia
Z1 Compact running Android 4.4.4.
Doesn't record a voice memo for me when actually in OSMTracker - but that's
probably because I've got "Headset Button Controller" intercepting the Mic
button as a Play/Pause command for a specific music app.
Original comment by kevswind...@gmail.com
on 5 Feb 2015 at 8:36
Original comment by nicolas@guillaumin.me
on 6 Feb 2015 at 11:50
I tried three different phones (Runbo X6, Sony ST21i (Xperia Tipo) and Lenovo
Yoga Tablet 2) with two headphone sets (one with single button, second with
three buttons).
Good news is that it works without setting priority on intent-filter.
Strange thing is that even with priority set to 1000 I was unable to reproduce
reported issue with any phone or headset I listed.
I think you can close this issue.
Original comment by m.zd...@gmail.com
on 28 Feb 2015 at 11:16
Original issue reported on code.google.com by
emil...@klein.st
on 20 Jan 2015 at 9:26