To check if music is playing in any other application. Use
AudioManager.isMusicActive();
And if you want to know about your music app.
Add Listener to Listen
mediaPlayer.setOnPreparedListener(this); mediaPlayer.setOnCompletionListener(this); mediaPlayer.setOnErrorListener(this);
you can add a boolean to verify isPlaying;
boolean isPlaying= false; //false by default
and when you start mediaPlayer at the very moment set isPlaying=true , and you're good to go.
Nepster
source share