title: How to check if music is being played from which music app?
body: <p>How do i check from which music app the music is getting played in android device?</p>
  
  <p>Using AudioManager, we can check if the music is being played or no. But it doesn provide the details of the music app from which it is being played.</p>
  
  <blockquote>
    <p>AudioManager am =
    (AudioManager)this.getSystemService(Context.AUDIO_SERVICE);</p>
  </blockquote>
  
  <p><code>am.isMusicActive()</code> returns <strong>true</strong> if music is played in device. But i want the music app name from which it is being played.</p>
  
  <p>References :</p>
  
  <blockquote>
    <p><a href="https://stackoverflow.com/questions/7323915/how-do-you-check-if-music-is-playing-by-using-a-broadcast-receiver">How do you check if music is playing by using a broadcast receiver?</a></p>
    
    <p><a href="https://stackoverflow.com/questions/6694336/android-development-to-find-out-which-app-is-playing-music-currently">Android development : To find out which app is playing music currently</a></p>
  </blockquote>
  
  <p>For instance, if i play music from Google Music player. Then i have to be able to get the music app name as "Google Music Player".</p>
  
  <p>Any reply for this would be appreciated. Thanks!</p>