Background
I want to see if I can get information about the currently playing song, to be able to show more information about it, or just the information I get instead.
I've wanted to check it out because I've noticed there is a setting (here) on a popular music player app called "Musicolet", of "Broadcast album art". Sure it says just "album art", but it also says it's for "3rd party". So I wanted to investigate if it's possible.
The problem
Not sure if it's possible or not. I see conflicting answers about it.
What I've found
I've found some interesting links about it:
- I've also found a question on StackOverflow (here) about getting it, but it is missing some crucial code.
- On the other hand, I've found another post saying that it's not official and that you probably can't do it, here.
- I've noticed that Spotify had (or still have?) something like that (here, except I can't see album art there), but it's a bit old.
- I've also found an interesting interface RemoteControlClient.OnMetadataUpdateListener (from here), but couldn't find any sample or tutorial about it, except perhaps this one one from XDA.
Of course, I tried using the tips I've found from those links, but failed to get anything to really work.
So maybe it was not possible in the past, and then it was possible. But then for some reason I don't see a sample/tutorial of how to use it, including on the docs.
I think that it if's possible, it requires notification access, because it's about the same as reading the currently playing music from the notification of the music player.
The questions
Is it possible to register to a callback (and also query whenever you wish) of when a song plays, and get information about it ?
Meaning song-title, album-name, file-path/uri, album-art...
If it's possible, how? What does it require?
If it's not possible, is there any workaround? Anything that works for some apps? Maybe something that exists in the notifications, more officially, that I can detect that it's of this kind, and fetch this information?