Search code examples
androidandroid-studiogoogle-pixel

How to access the list of songs in Pixels "Now Playing" feature?


So I'm trying to make an app on Android Studio that reads all the songs on Google's Now Playing Ambient services and makes them into a list. However I've been trying to figure out how to access the songs and have been unable to, does anyone know how to access that?

Thanks


Solution

  • You can't, there is no System API to access that history of songs.

    That being said, there is one way you can capture the list for future - you will need access to user's notifications. Each time a notification for "Now Playing" occurs, you can capture that data and make your own list within the app.

    You can use NotificationListenerService to determine if a new notification is for "Now Playing" feature or not. If it is then you can do something with that data.

    There is already an app out there that uses this functionality - https://play.google.com/store/apps/details?id=com.greatbytes.nowplayinghistory.