84b6f442fc
Previously the MediaSession object created in PlaybackService in onCreate would be completely empty. This seemed to confuse Android Auto, and prevented it from restarting playback. Filling the MediaSession object using the data from the player state at onCreate resolves this problem. This is documented in Android Auto docs[1], albeit indirectly and somewhat confusingly. Also move the setSessionToken call to the end of onCreate handler to ensure that the media session has already been completely filled by the time the session token is made available to the framework. There is no evidence that this is required; however intuitively, this is likely the trigger for the framework to start querying the media session. The change was tested both with Desktop Head Unit and with a real vehicle. [1] https://developer.android.com/training/cars/media/#initial-playback-state |
||
---|---|---|
.. | ||
src | ||
README.md | ||
build.gradle |
README.md
:playback:service
The main service doing media playback.