1

In android 11 I cant rename playlists anymore.

Here is the error which I'm getting:

java.lang.IllegalArgumentException: Movement of content://media/external/audio/playlists which isn't part of well-defined collection not allowed

Here is my code:

fun renamePlaylist(id: Long, name: String) {
    try {
        val values = ContentValues(1)
        values.put(MediaStore.Audio.PlaylistsColumns.NAME, name)
        context.contentResolver.update(
            Playlists.EXTERNAL_CONTENT_URI,
            values,
            BaseColumns._ID + "=?", arrayOf(id.toString())
        )

        context.scheduleTask(PlaylistRenamed, null)
    } catch (e: Exception) {
        firebaseCrashlytics.recordException(e)
    }
}

Can you help me to resolve this issue.

Thanks, Petros

Petros Mosoyan
  • 238
  • 2
  • 15

0 Answers0