Google Assistant is a ridiculously powerful piece of software, but it’s more useful when developers take the time to integrate its capabilities into their applications. Today, Google is detailing how developers on Android can integrate their media apps with Google Assistant.
In a blog post on the Android Developers Blog, Google highlights the MediaSession APIs as the best way for developers to bring Assistant to their apps. The idea here is that, by using this API, media apps such as music players will be able to be controlled by Assistant both on the phone, and on other devices such as Android Wear, Android TV, and more.
This API can be used to control things such as active music playback (play, pause, skip, etc), as well as asking for specific tracks, genres, or albums to be played through the app. This can also be used to control video depending on the platform the app is being used on.
The Google Assistant uses MediaSession in the same way as other external controllers such as Android Wear do. Each of these controllers cause state changes inside your app, and there needs to be a way to respond to these changes. This is where MediaSession comes into play. By using MediaSession, the Google Assistant can control your app’s media playback, as well as stay synced with its current state.
Google’s full blog post offers up a bit more information on how developers can take advantage of this API, as well as some sample projects, tutorials, and tests to get things up and running.
FTC: We use income earning auto affiliate links. More.