I am trying to play a famous playlist in the Spotify application. The best I have is to download a playlist, but not play.
Two things I've tried. Play from search first:
Intent intent = new Intent(MediaStore.INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH); intent.setComponent(new ComponentName("com.spotify.music", "com.spotify.music.MainActivity")); intent.putExtra(MediaStore.EXTRA_MEDIA_FOCUS, MediaStore.Audio.Playlists.ENTRY_CONTENT_TYPE); intent.putExtra(MediaStore.EXTRA_MEDIA_PLAYLIST, <PLAYLIST>); intent.putExtra(SearchManager.QUERY, <PLAYLIST>); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);
I tried replacing PLAYLIST with the name of a famous playlist. Also tried things like "4Rj0zQ0Ux47upeqVSIuBx9", "spotify: user: 11158272501: playlist: 4Rj0zQ0Ux47upeqVSIuBx9", etc. All this makes an unsuccessful search for these strings.
The second attempt is an intention of the form:
String uri = "https://play.spotify.com/user/11158272501/playlist/4Rj0zQ0Ux47upeqVSIuBx9"; Intent intent= new Intent( Intent.ACTION_VIEW, Uri.parse(uri) ); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);
Loads a playlist, but does not play. If I then use one of the methods to send the key KEYCODE_MEDIA_PLAY, it just resumes the current playlist, and not this recently downloaded list.
Any help anyone (including Spotify devs)?
BTW I do not want to use the Spotify SDK to implement my own Spotify Player - it seems shameful to do this when a completely good player is already installed on the user device.
source share