title: How to automatically play Playlist in Spotify Android app
body: <p>I'm trying to play a known playlist in the Spotify app. The best I've got is to load the playlist, but not play it.</p>
  
  <p>Two things I've tried. Firstly to play from search:</p>
  
  <pre><code>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, &lt;PLAYLIST&gt;);
  intent.putExtra(SearchManager.QUERY, &lt;PLAYLIST&gt;);
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  context.startActivity(intent);
  </code></pre>
  
  <p>I've tried replacing PLAYLIST with the name of a known playlist. Also tried things like "4Rj0zQ0Ux47upeqVSIuBx9", "spotify:user:11158272501:playlist:4Rj0zQ0Ux47upeqVSIuBx9" etc.  All these do is a failed search for these strings.</p>
  
  <p>Second attempt is the View intent:</p>
  
  <pre><code>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);
  </code></pre>
  
  <p>This loads the playlist, but does not play.  If I then use one of the many ways to send a KEYCODE_MEDIA_PLAY key, it just resumes the currently playing list, not this newly loaded list.</p>
  
  <p>Any help from anyone (including Spotify devs)?</p>
  
  <p>BTW I don't want to use the Spotify SDK to implement my own Spotify Player - it seems a shame to have to do this when a perfectly good player is already installed on a user's device.</p>