java.lang.UnsupportedOperationException Albums cannot be directly modified

|▌冷眼眸甩不掉的悲伤 提交于 2020-08-09 19:52:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!