title: Getting the details of the current song playing in the media player in Android
body: <p>I'm currently using a method similar to the one below to retrieve the information, however I am not sure how I can obtain the genre. Does anyone know what the string extra is called for genre or if there is an extra at all? Thanks.</p>
  
  <p><a href="https://stackoverflow.com/questions/10510292/how-to-get-current-music-track-info">Track info of currently playing music</a></p>
  
  <pre><code>public class CurrentMusicTrackInfoActivity extends Activity 
  {
  
   public static final String SERVICECMD = "com.android.music.musicservicecommand";
  
  @Override
  public void onCreate(Bundle savedInstanceState) 
  {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  
  
  
  com.sec.android.app.music.player.service.CorePlayerService
  
  IntentFilter iF = new IntentFilter();
  iF.addAction("com.android.music.metachanged");
  iF.addAction("com.android.music.playstatechanged");
  iF.addAction("com.android.music.playbackcomplete");
  iF.addAction("com.android.music.queuechanged");
  
  
  
  
  
  registerReceiver(mReceiver, iF);
  }
  
  private BroadcastReceiver mReceiver = new BroadcastReceiver() 
  {
  
  @Override
  public void onReceive(Context context, Intent intent)
  {
  String action = intent.getAction();
  String cmd = intent.getStringExtra("command");
  Log.v("tag ", action + " / " + cmd);
  String artist = intent.getStringExtra("artist");
  String album = intent.getStringExtra("album");
  String track = intent.getStringExtra("track");
  Log.v("tag",artist+":"+album+":"+track);
  Toast.makeText(CurrentMusicTrackInfoActivity.this,track,Toast.LENGTH_SHORT).show(); 
  }
  };
  
  }
  </code></pre>