title: Programmatically check which Music player is playing now
body: <p>Is there a way we can check <strong>programmatically</strong> <strong>Which Music player is playing right now</strong>? </p>
  
  <p>like <strong>Google Play</strong>, <strong>Samsung default Music Player</strong>, any <strong>3rd party music player</strong></p>
  
  <p>Actually, we need to programmatically handle <strong>play/pause of music player</strong>. Google Play and Samsung Music works differently with code :</p>
  
  <pre><code>// Google Play do not play pause with this code
  // it is using different package name i guess
  CmdStop = "togglepause";
  i = new Intent("com.android.music.musicservicecommand.togglepause");
  i.putExtra(CmdName, CmdStop);
  context.sendBroadcast(i);
  </code></pre>
  
  <p>Any help is appriciated</p>
  
  <p>Thank you</p>