Better integration with car hardware

Support questions for Neutron Player only.
Post Reply
marassa
Posts: 9
Joined: Tue Jul 08, 2014 4:50 pm

Better integration with car hardware

Post by marassa » Thu Jul 17, 2014 9:53 am

I woud like to have better control of the player from the steering wheel buttons (see the initial thread here: http://neutronmp.com/forum/viewtopic.php?f=5&t=2173).
Hardware: Flyaudio G7 head unit running Android 4.1 and providing pin-to-pin integration with the car hardware including steering wheel buttons etc.
NeutronMP supports steering wheel Prev/Next buttons out of the box. There's another button on the wheel (MODE) that swiches to the stock music player and cycles through its modes (CD/MP3/FM/AM/AUX) etc. As far as I understand, this is somewhat less standard event/intent/whateveryoucallthatinandroid than prev/next buttons or, say, making a phone call via bluetooth which seems to mute NeutronMP rather nicely (this said, I would prefer pausing to muting in this case but I digress). The question is (actually there are two questions):
1. What Android system mechanism might be possibly used by Flyaudio to pass the MODE button press to the stock player? How can I sniff for, identify and intercept the signal?
2. Provided I succeed in intercepting the signal, how can I programmatically make NeutronMP do what I want, like cycle through my playlists?
Alternatively, is there a way to assign different behaviours to single/double/long presses on prev/next buttons like a variety of headset control applications offer? I could do with a single press on the next button switching me to the next track and a double press switching me to the next playlist (or bringing up the list of my playlists to scroll and choose).
And another car related question: whenever I switch off the car and leave it, the head unit seems to enter a sort of a sleep mode it wakes from in a split second as I restart the car. The stock music player resumes playing immediately but NeutronMP not only doesn't resume playing, it requires a manual restart by tapping on its icon and it seems to restart from scratch, judging by the logo screen and a longish wait. What can be done to make Neutron MP resume playing automatically on wake-up?
Finally, NeutronMP shows the current track info in the Android top bar as it goes to the next track and even when the track changes in the radio stream which is great! But can I tweak the amount of time it stays on? Often it flashes so fast I miss it.
Would really appreciate any help with these ones.
Best regards,
Andrei

dmitrykos
Site Admin
Posts: 1914
Joined: Mon Apr 25, 2011 6:15 pm

Re: Better integration with car hardware

Post by dmitrykos » Tue Jul 29, 2014 9:48 am

> 1. What Android system mechanism might be possibly used by Flyaudio to pass the MODE button press to the stock player?

It can be custom modification in the firmware of the device. In general such universal API for different buttons does not exist. May be Mode button is bound to some key id which is passed to Android's core and which can be received into Android's Activity.onKeyDown() API. But may be it is not true and native player has also custom code which is getting those events.

> 2. Provided I succeed in intercepting the signal, how can I programmatically make NeutronMP do what I want

It can be possible for media buttons only. Cycling through Media Screen entries is not possible, but support for mouse wheel event is in to-do so it can be possible in the future. Since API 19 Android OS provides RemoteController (http://developer.android.com/reference/ ... oller.html) but for earlier Android OS versions it can be done by emulation of media buttons (there are many Android apps doing that).

> seems to enter a sort of a sleep mode it wakes from in a split second as I restart the car

It can be custom feature of the stock player too. You could try activating in Neutron - Play if Power Attached.

> can I tweak the amount of time it stays on? Often it flashes so fast I miss it

The information is changing once it changed in the network stream, so it can not be tweaked unfortunately.

marassa
Posts: 9
Joined: Tue Jul 08, 2014 4:50 pm

Re: Better integration with car hardware

Post by marassa » Tue Jul 29, 2014 11:18 am

Hi Dmitry,
Many thanks for your reply!
I already tested the assumption that it might be a broadcast intent but it isn't - Intent Intercept doesn't intercept anything.
There is some system application with a Chinese name running constantly, I suspect it might be handling all this hardware specific stuff. If you could suggest a way of how to find out what exactly this aplllication might be listening to and what kind of signals it sends to the stock player - I would greatly appreciate a kick in the right direction.
BTW, is there any packaged app that could listen to Activity.onKeyDown() and show every key that has been pressed?
I tried "Play if Power Attached" first thing - doesn't work. Still starts from scratch with the logo, progress bar etc and won't resume playing.
Thanks again!

dmitrykos
Site Admin
Posts: 1914
Joined: Mon Apr 25, 2011 6:15 pm

Re: Better integration with car hardware

Post by dmitrykos » Fri Aug 01, 2014 10:43 am

Hi Andrei,

> find out what exactly this aplllication might be listening to and what kind of signals it sends to the stock player

It can be that that app is keeping background process which is listening on localhost on some port. Client part of this is sending events to that localhost:port address which can be in any content as it depends on developer of that software. I do not know if it is possible to sniff in between this communication and only if it is like I said. If both those apps are system apps they can exchange with messages without even doing network communication on localhost, just as interprocess communication.

> is there any packaged app that could listen to Activity.onKeyDown() and show every key that has been pressed?

You could probably check Android NDK samples for that. I found such example with source: http://android-codes-examples.blogspot. ... er-in.html

Dmitry.

marassa
Posts: 9
Joined: Tue Jul 08, 2014 4:50 pm

Re: Better integration with car hardware

Post by marassa » Fri Aug 01, 2014 10:51 am

Thank you, will look into it!

Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests