Media Album Artist Playlist Intent
<p>In my Android application, I want the user to be able to select Albums, Artists and Playlists and then send an intent for their default media player to play them.</p>

<p>I fetch the ID in the standard way:</p>

<pre><code>final Uri exAudioUri = Uri.parse("content://com.google.android.music.MusicContent/playlists");

final String[] proj = { MediaStore.Audio.Playlists._ID, MediaStore.Audio.Playlists.NAME };

final Cursor musiccursor = ctx.getContentResolver().query(exAudioUri, proj, null, null, null);

    String name = null;
    String id = null;

        if (musiccursor != null &amp;&amp; musiccursor.getCount() &gt; 0) {
            while (musiccursor.moveToNext()) {
                name = musiccursor.getString(musiccursor.getColumnIndexOrThrow(MediaStore.Audio.Playlists.NAME));
                id = musiccursor.getString(musiccursor.getColumnIndexOrThrow(MediaStore.Audio.Playlists._ID));
</code></pre>

<p>For Playlists I'm using the following intent:</p>

<pre><code>    Intent playMediaIntent = new Intent(Intent.ACTION_VIEW);
    playMediaIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    playMediaIntent.setType(MediaStore.Audio.Playlists.CONTENT_TYPE);
    playMediaIntent.putExtra("playlist", playlistID);
</code></pre>

<p>The Google Play Music app intercepts this and plays the playlist successfully.</p>

<p>Trying to do the same for albums gives me an activity not found exception:</p>

<pre><code>    Intent playMediaIntent = new Intent(Intent.ACTION_VIEW);
    playMediaIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    //playMediaIntent.setType("vnd.android.cursor.dir/track");
    playMediaIntent.setType(MediaStore.Audio.Albums.CONTENT_TYPE);
    //playMediaIntent.setData(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI);
    playMediaIntent.putExtra("album", albumID);
</code></pre>

<p>I know these are undocumented methods and subject to change, but I don't want to have to implement an entire media player of my own, when a user will already have chosen their favourite....</p>

<p>Can anyone suggest any 'standard' code that media players will intercept?</p>

<p>Alternatively, is there a way to get all of the songs from the album (or artist) and send an intent with data containing an array of track URIs to play or queue up??</p>

<p>Been to the depths of Google/Stackoverflow on this one and drawn a blank...</p>

<p>Please help! I thank you in advance.</p>
