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

When connecting Android Auto to the app, music auto plays #1154

Open
gravelld opened this issue Sep 22, 2023 · 0 comments
Open

When connecting Android Auto to the app, music auto plays #1154

gravelld opened this issue Sep 22, 2023 · 0 comments

Comments

@gravelld
Copy link

When I run the Android Auto desktop-head-unit and connect it to a physical Android device running D-Sub, the playback seems to resume its last state.

The trouble is that this contravenes the Android Auto quality guidelines (MA-1). Apps submitted to the Play Store may be rejected as a result.

I've been looking through the code and I can see that doPlay is called on our MediaSessionCompat.Callback as registered in RemoteControlClientLP.

However, the same callback is called when someone presses the play button, and there's no contextual information for the event. So how do we know when to prevent playback, and when to allow it?

I've found that...

In AutoMediaBrowserService I can create a MediaBrowserCompat and register a MediaBrowserCompat.ConnectionCallback with that which tells us when Android Auto connects. This occurs before the doPlay().

If I remove the call in AutoMediaBrowserService to setSessionToken() with the RemoveControlClientLP's MediaSessionCompat then the auto play doesn't happen. I stepped through this code, but nothing seems to be done with that token directly from that call and I can't see any other requests on the session token, so I'm puzzled as to why that affects things.

Anyone got any guidance about how to debug this?

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

1 participant