Description
I am not sure to what extent the library handles Android Auto aside from the common playback controls and commands. However, I've been having some issues making my media app integrate with Android Auto ecosystem :
I use the following code to notify any controllers that my items have undergone some change :
//this is inside my implementation of MediaLibraryService
mediaSession?.notifyChildrenChanged(nodePLAYLIST, playlist.size, null) //playlist is a List
//or
mediaSession?.notifyChildrenChanged(nodeTRACKLIST, tracklist.size, null) //tracklist is a List
I have a root node which is my library root (the one I return under onGetLibraryRoot
). It has two children (which Android Auto chooses to show as tabs because they're browsable and not playable): A playlist node and a tracklist node, both which have their own list of items under them.
The media hierarchy is like this:
- nodeROOT
-- nodePLAYLIST
-- nodeTRACKLIST
However, the notifyChildrenChanged
works fine on my phone, I can receive the callback on my activity just fine. But on Android Auto, it will not update the UI until I leave the tab and go back to it again. This is annoying because the user performs a LOT of library modifications throughout the lifetime of the app, it is essential the Android auto refreshes the list of items that are visible to the user as soon as the callback is executed.
Do I need to do something else ? Or am I just doing it wrong ?