Is there a way to find out which music is currently playing in the android Music player ? So I want to catch the title time and maybe the author of this music and show it with Textview. Is this possible ?
In concordance with the Android API here: AudioManager should be what you are looking for
You can create an AudioManager
and then call the isMusicActive
to retrieve a boolean if it is playing.
You can then use the MediaPlayer API and call the getTrackInfo
method which returns an Array
of track-related information.
Edit:
Also, MediaPlayer
has an isPlaying
method which really makes AudioManager rather useless in this scenario.
[Update]
For future viewers of this question; when you create a MediaPlayer
object and call the getTrackInfo
method; it returns an array TrackInfo[]
; the API for TrackInfo[]
and it's methods can also be found here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With