2

I am extending my audio streaming app to work with Android Auto, I have implemented a MediaBrowserService and all is working well. If during playback a stream returns an error, I update the MediaSession appropriately passing a state of PlaybackStateCompat.STATE_ERROR. In this case Android Auto shows the error on screen but I cannot see any way of dismissing the error. If I navigate back to my apps menu within Android Auto I can see it making requests to my Service to gather MediaItems but the error message stays on the screen.

The only way to recover is to exit Android Auto and then reopen it, the error is then gone and the MediaItems are again visible to browse and play.

Do I need to update the MediaSession somehow to remove the error state or should there be a way of dismissing the error message on screen?

For reference I am using the Android Auto app on my phone to test this.

Thanks

Michael J
  • 825
  • 1
  • 9
  • 18

1 Answers1

-1

Yep, you’ll need to update the media session with a new playback state to dismiss the error instead of an action on the screen. The media session sends / receives all communication with the player, and the player is only called from the media session that controls it.

Here’s a couple of links on working with error states:

Audio Playback for Auto: Handling Errors

MediaSession States and Errors

salminnella
  • 744
  • 2
  • 6
  • 17
  • 1
    This actually didn't work for me, no matter what state I am setting after the error state - it's still only error. Not sure what is happening there. – ArieDov Nov 08 '19 at 13:24
  • Did you ever find a solution to this? I'm running into it as well. It seems Google didn't take into consideration how the user is supposed to refresh an Android Auto app after an error occurs. – Kris B Feb 21 '22 at 23:48