Should be really simple. I just want the default mp3 player to open when a button is pressed as its own activity. I need it to work on api 3 and higher
This opens a media player but it is not the default:
//doesnt open default player
Intent viewMediaIntent = new Intent();
viewMediaIntent.setAction(android.content.Intent.ACTION_VIEW);
//File file = new File(objectFilePath);
viewMediaIntent.setDataAndType(null, "audio/*");
viewMediaIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
act.startActivity(viewMediaIntent);
this doesn't work:(no activity found to handle intent)
Intent intent = new Intent("android.intent.action.MUSIC_PLAYER");
act.startActivity(intent);
This also works but not for default:
Uri uri = Uri.withAppendedPath(MediaStore.Audio.Media.INTERNAL_CONTENT_URI, "1");
Intent it = new Intent(Intent.ACTION_VIEW, uri);
act.startActivity(it);
thank you for your time.