问题
How to update album metadata of audio file in Android Q media store?
I tried the answer suggested, https://stackoverflow.com/a/60152702/4732846, 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 ?
来源:https://stackoverflow.com/questions/62277997/java-lang-unsupportedoperationexception-albums-cannot-be-directly-modified