Search code examples
androidaudio-playerandroid-music-player

How to find out if a song is playing or not?


I am developing an application.

Related to my application,

I want to know if any audio song is playing or not in the backgroud through any other music player apps or the default musicplayer come with mobile.

If anyone knows the solution please help me.


Solution

  • You need to use isPlaying() in the MediaPlayer class.

    isPlaying() will return false when the default MediaPlayer application is not currently playing, so you must be using some other music application that we are not aware of. You should probably post your code, if that is the case.