A resource that Google provides Android developers with are sample applications that showcase how to implement various OS features. One of these is the Universal Android Music Player, which Google just rewrote using Kotlin as part of a v2 update.
Abbreviated as UAMP, Google notes that this four-year old sample is “a favorite on GitHub for music app developers with over 9,500 stars and 3,000 forks.”
The goal of this sample is to show how to implement an audio media app that works across multiple form factors and provide a consistent user experience on Android phones, tablets, Android Auto, Android Wear, Android TV, Google Cast devices, and with the Google Assistant.
However, it was due for an update given how “Android development has changed significantly” with an improved ExoPlayer, Architecture Components, and Kotlin.
To integrate and teach developes about all the recent additions to the operating system, Google today announced UAMP v2, which was “built from the ground up in Kotlin.”
The UI is built around ViewModels and LiveData. Playback, and particularly integration with MediaSessionCompat, was vastly simplified by utilizing the MediaSession extension of ExoPlayer.
Some features the v1 — which can still be accessed — have yet to be integrated, including the Android TV interface with the Leanback library and remote Google Cast playback. Google is also considering a standalone Wear UI and offline playback.