I am developing an application where I need to start the default music app and play all the songs. I have tried a number of approaches, but nothing seems to work.
Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage(
"com.android.music.MediaPlaybackActivityStarter");
startActivity( LaunchIntent );
and
Intent intent = new Intent();
ComponentName comp = new ComponentName("com.android.music",
"com.android.music.MediaPlaybackActivity");
intent.setComponent(comp);
intent.setAction(Intent.ACTION_RUN);
startActivity(intent);
Just starts the music player
Intent i = new Intent(Intent.ACTION_VIEW);
Uri u = Uri.withAppendedPath(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, "1");
startActivity(i);
Plays just the first song.
Use this for api below 15
and later use
android.intent.category.APP_MUSIC
.To simply launch the music player do:
please note, that this works only in SDK API level 8 up
I think you should implement your playlist which you can pass your list to mediaplayer and set your next song in mediaplayer.onCompletion ().
Next()
Or you can try open m3u (playlist) file.
I recently also started getting this issue after some security updates. To solve this you need to disable all notifications from the default music player. Do this by going to Settings/Apps & Notifications/Apps/Music Then make sure all notifications are set to off and also block the app from accessing your storage.