我正在尝试查询由“Google Play 音乐”应用程序创建的播放列表,但未能成功。我使用本地存储的内容创建了一个播放列表。我使用以下代码查询:
Cursor c = managedQuery(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,
new String[] {MediaStore.Audio.Playlists._ID,
MediaStore.Audio.Playlists.NAME
}, null, null, null);
这适用于 Winamp 但不适用于 Google Play 音乐。事实上,Winamp 不显示使用 Google Play Music 创建的播放列表。但是,Google Play Music 会显示使用 Winamp 创建的播放列表。我的猜测是 Google Play 音乐正在使用自己的数据库来存储播放列表,而其他播放器使用 Content Provider 和 uri MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI 来存储他们的播放列表。有没有办法获取使用 Google Play 音乐创建的播放列表?
最佳答案
我知道这个帖子很旧,但我也一直在努力解决这个问题。
Google Play 音乐在此非标准内容 URI 中公开其播放列表
// list all playlists with their ID and Name
Cursor cursor = getContentResolver().query(
"content://com.google.android.music.MusicContent/playlists",
new String[] {"_id", "playlist_name" },
null, null, null);
Google Play 音乐内容提供者使用以下列名称
- 都是本地的
- playlist_owner_name
- 有本地
- 有远程
- 有任何
- 保持身份
- playlist_art_url
- playlist_share_token
- _id
- _计数
- playlist_owner_profile_photo_url
- 保持歌曲计数
- 播放列表说明
- 播放列表类型
- 播放列表编号
- 保持下载歌曲数
- 播放列表名称
如果没有这个非常有用的应用程序,我永远也想不通 Content Provider Helper
关于android - 在 Android 中查询 Google Play 音乐数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9669358/