How to update album metadata of audio file in Android Q media store?
I tried the answer suggested, https://mcmap.net/q/1408208/-how-to-update-metadata-of-audio-file-in-android-q-media-store, it worked. But this works for individual tracks.
If I use the same logic and form the uri for albums,
val uri = ContentUris.withAppendedId(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
albumId)
and try to edit. I get this exception.
java.lang.UnsupportedOperationException Albums cannot be directly modified
This is the closest link that I could find for the error. https://android.googlesource.com/platform/packages/providers/MediaProvider/+/refs/heads/master/src/com/android/providers/media/MediaProvider.java
Searching for the above exception I found that, for the above uri [album type uri] , other than TYPE_QUERY, i.e TYPE_UPDATE, TYPE_DELETE is not allowed and the exception gets thrown.
So how do I update album metadata in Android Q ? (OR) Is this the expected behaviour going forward from Android Q, that editing metadata of album, artist would not be allowed ?
MediaStore.Audio.Media.ALBUM_ID + "= ?"
and album id as selection. This works fine with pre Q. Though, on Q it does not support that approach. So, the only way I think of is to modify each track individually until you modified them all. If you find a solution where you could modify them in batch, let me know. Regards. – Madrigalist