Get Metadata from Now Playing (external app)

I've been developing an app for a tablet, to stay always awake and show most important information on screen (hour, player, calendar, etc), but I can't find information about how to get information about the now playing from an external app and how to make functional buttons for this. For example, a song is playing on Spotify, I want that the info showed (artist, canva, album, song) shows also in my app.

How can I make this?