android - 在 Android 中查询 Google Play 音乐数据库

标签 android android-contentprovider

我正在尝试查询由“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/

相关文章:

android - 查询 Android 数据库以获取特定数据

android - 多个运行时权限 - 仅请求第一个

android - 如何对LiveData转换进行单元测试

android - 如何使用 WorkManager 安排通知?

java - 在 android 9 中加载 webView 时出现 ERR_INVALID_RESPONSE

android - 当我们使用 SQLite 时,当我们使用 content provider 时,当我们使用 Shared preference 时

java - 删除不适用于 HTC 的通话记录

Android:通过内容 uri 删除文件

android - 为什么Android ContentProviders 是REST 服务?

java - 如何异步接收来自Web的数据并在下一行代码中使用结果字符串?