Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Auto Support #231

Closed
ghost opened this issue Jun 22, 2015 · 64 comments
Closed

Android Auto Support #231

ghost opened this issue Jun 22, 2015 · 64 comments

Comments

@ghost
Copy link

ghost commented Jun 22, 2015

There are NO audiobook players for Android Auto and it could be a wonderful niche to get in to early. I have no idea if the Auto program is open yet or still only if you're partnered with Google, but I think the first audiobook player out for it would get some huge notoriety.

@PaulWoitaschek
Copy link
Owner

When I have more time I'll work on it. In the meantime if anyone wants to start on this, give me a quick notice ;-)

@PaulWoitaschek
Copy link
Owner

So finally some basic support here. Can you try it and give feedback?

player.zip

@ghost
Copy link
Author

ghost commented Mar 23, 2016

I uninstalled the main app and installed that zip but it's not showing up in android auto music section.

@PaulWoitaschek
Copy link
Owner

Its already integrated in the latest version.

Which version do you use?

@ghost
Copy link
Author

ghost commented Mar 25, 2016

I uninstalled all versions of the app then installed the the app off the play store (v2.7)
Its plugged into a Skoda Octavia, other apps come up like Pocketcast and Spotify. Should it just come up under the headphone icon?

@ghost
Copy link
Author

ghost commented Mar 28, 2016

After the last app update everything seems to be working.

@ghost
Copy link
Author

ghost commented Apr 5, 2016

With the latest update (V 2.7.2.1) the player has gone missing again from the AA interface. Have tried an uninstall and reinstall but still nothing. Any suggestions?

@PaulWoitaschek
Copy link
Owner

Which version were you using before? Fdroid?

@ghost
Copy link
Author

ghost commented Apr 5, 2016

What ever the latest version off the play store was, before the last update.

@PaulWoitaschek
Copy link
Owner

Are you a participant of the beta?

@ghost
Copy link
Author

ghost commented Apr 5, 2016

No, but i would be happy to test it out

@allmynamesweretakenomoreideas

With v2.7.2.1 MP does not show up on android auto screen. (AA v1.6.240030). And play store does not list MP under AA compatible apps. What are the requirements for an app to get AA certified?

@TangoIndia
Copy link

Hi, I have joined the beta, and am using the current 2.7.2.2 version of the App and i can also confirm that it doesn't work with Android Auto, but would love it to!
However your app is fantastic. Thanks!

@TangoIndia
Copy link

Hi, does anyone have a solution for this? thanks

@aperomsik
Copy link

aperomsik commented Nov 9, 2016

Now that Android Auto can work without specific support from the car, it would be great to get this sorted. Android Auto would make it much easier to switch back and forth between this app and a music player.

@PaulWoitaschek
Copy link
Owner

I'm really willig to bring Android Auto Support to this app, but it just doesn't work.
I implemented everything but the app does not show up at all in the list of apps.

So yeah, any support is appreciated.

@ztNFny
Copy link

ztNFny commented Nov 9, 2016

I'm not really familar with Kotlin but I'm assuming PlaybackService.kt is extending MediaBrowserService properly? Otherwise I really can't spot any errors, Manifest and stuff seems to be in order - or maybe the tools:ignore="ExportedService"?
Are you aware of this sample project? https://github.com/googlesamples/android-MediaBrowserService

@PaulWoitaschek
Copy link
Owner

tools:ignore just supresses a lint warning, that's nothing that end up in the production version.
I just compiled that sample project today and it also doesn't show up in android auto.

Todays update got refused

  • Your app does not support all of the required voice commands. The app does not appear
    on the media picker. Voice commands are not acknowledged when used on AA.

You can read more about how to support Voice Actions here: https://developer.android.com/training/auto/audio/index.html#support_voice

Where the important line is

The app does not appear on the media picker.

@aperomsik
Copy link

Perhaps they are saying that the app will not be allowed on the media picker if it does not support the required voice commands?

@ztNFny
Copy link

ztNFny commented Nov 11, 2016

Wanted to look into this but am still having some trouble with Kotlin. Could you post apk with the Auto entries and I'll try to figure something out with the binary.
Also maybe have a look at https://bitbucket.org/ChernyshovYuriy/openradio/src, an Auto-enabled OSS app.

@aperomsik
Copy link

There is also a list of requirements here in a long comment in the demo player. I might be missing something due to Kotlin but to me it smells like you might be missing the line " setSessionToken(mSession.getSessionToken()); "

@PaulWoitaschek
Copy link
Owner

Perhaps they are saying that the app will not be allowed on the media picker if it does not support the required voice commands?

Also with voice intent it doesn't even show up.

Wanted to look into this but am still having some trouble with Kotlin. Could you post apk with the Auto entries and I'll try to figure something out with the binary.

I'm not next to a machine the next days. Just enable the auto entry in the manifest I built.

There is also a list of requirements here in a long comment in the demo player.

Which ones are we missing? The demo player does not show up neither.

it smells like you might be missing the line " setSessionToken(mSession.getSessionToken())

That happens here

@aperomsik
Copy link

aperomsik commented Nov 13, 2016

Finally got a chance to play a little more. I just took the master branch and reverted the commit to disable auto registration. The app does not appear for me on the phone screen in android auto, but it does appear in the "desktop head unit" emulator for developers. First you have to put the Android Auto app in developer mode, by going to the About screen and tapping the header ten times. After that Material Player still doesn't appear in Android Auto's player list on the phone but it does appear in the DHU. (Not sure if you have to switch "app mode" to "developer" in the developer settings menu... it seems to appear without that for me but I did have it set to developer earlier.)

So I'm guessing you have to test it in that mode, then when you believe it's working, including the voice actions, then you submit it to Play again and their reviewers decide whether to enable it for everybody if it meets their quality criteria.

Two asides:

(1) When testing earlier this week the master branch wasn't letting me add folders from my SD card. The version from Play Store was working fine, Now the master branch is working better too, due to your recent work. Thanks for fixing it.

(2) When testing with the DHU sometimes the forward/back skip buttons would cause the audio to pause. Skipping again resumes playback. I have seen this behavior in my car too, over regular bluetooth audio connection. In the car it seems most likely to happen if I push the "skip back" button twice.

If you have more questions about criteria, perhaps the Android Auto Developers group in G+ could help.

screenshot from 2016-11-12 18-56-35

@PaulWoitaschek
Copy link
Owner

Hm; I gave it another try. According to this only the intent is required and the service should handle it.

However the whole android auto thing is very frustrating. The ADH most of the time does not start, stays black or does not work in other ways.
I cannot test the voice commands at all. When I use mic play voice/pause.wav like descripbed here it just responds with

Not sure how to help with... "Pause music"

Thats stupid - even the google play app responds with that message.

@PaulWoitaschek
Copy link
Owner

@GoodSir42
Copy link
Contributor

Hi Paul,
since I have a real head unit now I'd like to jump into this. Do you have any more info on how to test the app myself? Do I have to sign the app in a specific way to allow it to work with android auto or will any development version just show up?

@PaulWoitaschek
Copy link
Owner

There is a section on the manifest that is commented out. Uncomment that and start the app. I'm not sure about further steps.

@GoodSir42
Copy link
Contributor

I'll let you know if I run into anything. Is the audio not nuting part the only issue that remains (as there's quite a long list of things to be done for auto apparently)

@PaulWoitaschek
Copy link
Owner

Yes, what's listed under false alarm is what's remaining.
Also I'm not sure about the search functionality. Is currently very rudimentary.

@GoodSir42
Copy link
Contributor

My findings so far: the pause seems to work well (I'll test this in the coming days with my car/real head unit, perhaps that's different from the simulator). However the search is not working at all.

I can't even see the callback being called. Is it possible, that the MediaSession is not active at the right time?

@GoodSir42
Copy link
Contributor

Hi @PaulWoitaschek

I'll need a bit of help here. I'm not familiar with Kotlin (yet), but perhaps you can give me a hint. I continuously get the message that kolin line breakpoints are not supported by my debugger. do I have to have some specific setting to allow me to debug the app?

@PaulWoitaschek
Copy link
Owner

Are you using Android studio and installed the kotlin plugin? Debugging should work as usual. Just not inside inline functions as they are - as the name says: unlined by the compiler.

If you have further issues we can Skype if you like.

@GoodSir42
Copy link
Contributor

I managed to get some queries through to the app (although the google recognition in german as well as english is less than reliable). To me it looks like it's working well. Audio is paused for the query, and if it's recognized as a valid "play" query the command is forwarded to the app properly and it look for a book. The search could be a bit more sophisticated (I might go to this one as teh next step), but the general aproach seems to be fine. I sent you a skype request for more discussions, perhaps we can get this through the google play testing soon together.

@GoodSir42
Copy link
Contributor

Hi Paul,

I implemented the voice search queries for Android auto (or any other voice query, for example from google now) here https://github.com/Eifelschaf/MaterialAudiobookPlayer/commit/a3dbd67cb92611ddab5ba61256703217991612b5
I just have one minor issue. Is it possible to start playing at a specific title? There are some commands that include a title in the query and I'd like to start the playback at the given chapter if I find a match. Right now the app will just play the book that contains the chapter.

@PaulWoitaschek
Copy link
Owner

That would be possible but I think it's better not to do it. Else when voice detection is flaky you might lose the latest position in your audiobook. So I'd rather do the book switching functionality only.

@nioncode
Copy link

It's probably a really uncommon situation to play exactly Chapter 23 from Book 42.
Usually, you just want to either resume the last played book or switch to another book.

Does skipping back and forth between chapters work via voice?

@GoodSir42
Copy link
Contributor

GoodSir42 commented May 21, 2017

Titles are just supported by the voice search API, but I'll remove the title specific code.
I just thought it might come in handy for people not using it for audio books. Some chapter enabled podcasts might be an example, or the fairy tale CDs for my kids, where I'd like to play a specific title. You are not forced to use the "play title X from artistY on Z" query. For Audiobooks "play Z" woudl be more than enough I guess. I was just thinking about supporting it. I don't know if google's tests might fail because of that, so let me know when you want to have it re-enabled.

@nioncode Skipping chapters should work via the next/previous commands.

@PaulWoitaschek Thanks for the review. Here's the commit that should fix all your remarks. https://github.com/Eifelschaf/MaterialAudiobookPlayer/commit/c77081b622764875b35146be5875a8c565fbada4

@PaulWoitaschek
Copy link
Owner

Thanks :)

To summarize our skype talk:

I would test the BookFinder isolated without the activity. Therefore I would inject the required dependencies through the constructor and mock them using mockito.

Also PlayerController should be favored over MediaPlayer as it starts the service if necessary. MediaPlayer should ideally be controlled by the service.

@GoodSir42
Copy link
Contributor

Just one more question: The current way of testing with the activity also tests the received intents (as they are standardized) so I guess it might make sense to keep it in some way or another to test the complete workflow. The guys at google might do nothing else. Any idea on how to keep these tests in an ideal way and still isolate the BookFinder?

@PaulWoitaschek
Copy link
Owner

That would be a different test I guess.

We could setup something like https://github.com/fabioCollini/DaggerMock.

So we could inject a mocked version of BookFinder.

Then we only need to do a verify(bookFinder).query(any(),any()).

@GoodSir42
Copy link
Contributor

For the daggermock we'd have to refactor all @Inject annotations to be inside a module. I guess that's something that you should do. I will see if I can isolate the BookFinder

@PaulWoitaschek
Copy link
Owner

Can you make a pull request? Then I'll prepare everything for the test

@GoodSir42
Copy link
Contributor

GoodSir42 commented May 22, 2017

Done.
#589

@PaulWoitaschek
Copy link
Owner

There are merge conflicts.

@GoodSir42
Copy link
Contributor

GoodSir42 commented May 22, 2017

I merged all your commits. Can I resolve them? (it says write access is required)
Found it. I'm fixing the issues right now.

@GoodSir42
Copy link
Contributor

GoodSir42 commented May 22, 2017

The issues are fixed, but circleCI fails at exoplayer. I guess that's also the reason why it says "circleci failing" on the front page?

@PaulWoitaschek
Copy link
Owner

Yes, and I have no idea how to fix that :)

@GoodSir42
Copy link
Contributor

if you don't mind I'll add a new issue/thread for that :) I think I found something, but don't want to spam here.

@PaulWoitaschek
Copy link
Owner

Wow it got approved!

However it still needs approvements as it works very poorly for me.

@GoodSir42
Copy link
Contributor

GoodSir42 commented May 24, 2017 via email

@GoodSir42
Copy link
Contributor

After having used the android auto integration for a week now I have a few improvements no my mind and would like to have your opinion on them:

  1. It would be nice if we would have a previous/next chapter button in addition to the skip back/forward buttons on the main UI. At least in some sort of overflow menu. It's hard to jump to the beginning of a lengthy chapter in the current implementation
  2. It would also be great to just display the current book on the main screen when the app is opened instead of "only" having it on top of the list.

On Android Wear I think I could fix the image loading of the cover artworks at the same time, but that's another topic.

What do you guys think about that? I'd be happy do do the work, but let me know if there's anything against any of the points above (or something you noticed as missing)

@PaulWoitaschek
Copy link
Owner

Yeas sure, I don't think anything speaks against that.

It would also be great to just display the current book on the main screen when the app is opened instead of "only" having it on top of the list.

This should be achievable by setting the current book in paused state once connected to android auto.

It would be nice if we would have a previous/next chapter button in addition to the skip back/forward buttons on the main UI. At least in some sort of overflow menu. It's hard to jump to the beginning of a lengthy chapter in the current implementation

I assume this is a limitation of Android Auto. You really cannot control the UI. If you find anything, feel free to implement it. However I find the importance of the seek functionality way greater than the importance of the chapter skip functionality.

@GoodSir42
Copy link
Contributor

GoodSir42 commented Jun 22, 2017

I've seen this kind of secondary buttons on some podcast players. It hides the extra actions in an overflow menu and makes them accessible on tap. I'll look into it as soon as I find the time

@PaulWoitaschek
Copy link
Owner

Thanks! For further improvements please open a new ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants