Is there any way to programatically open the Android Music Player?
I'm sure there is some kind of Intent somewhere but I cannot find it.
James
android.intent.action.MUSIC_PLAYER
is your friend. See MediaStore on Android Docs for further information.
Create a new intent:
Intent intent = new Intent("android.intent.action.MUSIC_PLAYER");
startActivity(intent);
Since API level 15: action="android.intent.action.MAIN" category="android.intent.category.APP_MUSIC"
since api 15 android.intent.action.MUSIC_PLAYER is deprecated try this code
try {
String pkgname = "com.sec.android.app.music";
PackageManager pkgmanager = getPackageManager();
Intent intent = pkgmanager.getLaunchIntentForPackage(pkgname);
startActivity(intent);
} catch(Exception e) {
// music player not found
}
add this code on your on click listener and this will open the default music player