1 year ago

#102966

test-img

Petros Mosoyan

Playlist Rename with Mediastore on Android 11

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

rename

mediastore

playlist

android-11

0 Answers

Your Answer

Accepted video resources