0
我目前使用的是類似於下面的方法來檢索信息,但我不確定如何獲取該類型。有人知道什麼字符串額外被稱爲流派,或者如果有額外的東西?謝謝。獲取Android中媒體播放器播放的當前歌曲的詳細信息
Track info of currently playing music
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();
}
};
}
你是什麼意思與類似的方法?這樣向我們展示你的代碼。 – tolgap 2012-08-09 19:52:51
我的意思是類似於所提供的鏈接中的代碼。我現在編輯它以顯示代碼。 – user1015492 2012-08-09 20:14:11
嘗試在市場中運行Intent應用程序,看看周圍有什麼傳遞。 – 2012-08-09 23:44:58