binW
binW

Reputation: 13672

How to start MusicPlayer without specifying any music file in Android

In my app, I want to launch standard Music Player (with its full UI) when a button is pressed but I dont want to specify any file. I just want to open the player and then user can use it however they want. So the standard way of using intent with ACTION_VIEW and specifying media file will not work for me. So how can I launch this? Is there another way?

Upvotes: 1

Views: 506

Answers (2)

jacque006
jacque006

Reputation: 344

Intent intent = new Intent(MediaStore.INTENT_ACTION_MUSIC_PLAYER);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

Upvotes: 1

Junseok Lee
Junseok Lee

Reputation: 715

You can set the intent explicitly to the Music Player activity.

Intent intent = new Intent(getApplicationContext(), yourclass.class)

I think it should be com.android.Music.MediaPlaybackActivity.class but I'm not so sure about that part. If you want the browser, replace the activity with MusicBrowserActivity

Upvotes: 0

Related Questions