Android 无法获取在Google Play Music中创建的播放列表

Android 无法获取在Google Play Music中创建的播放列表,android,playlist,Android,Playlist,我在Google Play Music中创建了两个播放列表,但似乎没有找到播放列表。 我正在使用本主题中的代码 感谢您的帮助,伙计们您只能将这些代码用于使用默认Android媒体存储的音乐播放器。但是Google Play Music有自己的数据库。这就是为什么需要不同的uri和列名 要获取播放列表,我使用以下代码: Uri playlistsUri = Uri.parse("content://com.google.android.music.MusicContent/playlists")

我在Google Play Music中创建了两个播放列表,但似乎没有找到播放列表。 我正在使用本主题中的代码


感谢您的帮助,伙计们

您只能将这些代码用于使用默认Android媒体存储的音乐播放器。但是Google Play Music有自己的数据库。这就是为什么需要不同的uri和列名

要获取播放列表,我使用以下代码:

Uri playlistsUri = Uri.parse("content://com.google.android.music.MusicContent/playlists");
Cursor playlists = context.getContentResolver().query(playlistsUri, new String[]{"_id", "playlist_name"}, null, null, null);
然后,您可以在默认的Android媒体存储中获得与歌曲id相关的歌曲id。之后,您可以直接播放歌曲或获取歌曲的详细信息来处理任何事情

Uri songsUri = Uri.parse("content://com.google.android.music.MusicContent/playlists/" + playlistId + "/members");
context.getContentResolver().query(songsUri, new String[]{"SourceId", "hasLocal"}, null, null, null);
要从Android上的默认媒体存储中获取歌曲详细信息,您应该使用以下内容:

Cursor songDetailsCursor = context.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
                new String[]{MediaStore.Audio.Media.DATA},
                MediaStore.Audio.Media._ID + " = " + songId,
                null, null);

第一个查询只返回一条记录。i、 e,上次创建的播放列表。