I am trying (without luck) to update entries for MediaStore for both audio tracks and images. I am using something like this:
ContentValues values = new ContentValues();
values.put(MediaStore.Audio.Media.TITLE, title);
values.put(MediaStore.Audio.Media.YEAR, year);
resolver.update(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, values, MediaStore.Audio.Media._ID + "= ?", new String[] { String.valueOf(id) })
The above snippet works on API16->API28 without problems.
Though, on API29 it does not work. No errors are displayed on logs or messages. I am trying the above code on the API29 emulator. I am not sure if this issue is related to using an emulator or not.
I would really appreciate any information that points me in the right direction.
https://stackoverflow.com/a/60152702/786656 worked for me.
You need to call update
once with the flag IS_PENDING
set to 1. Then you call update
again with the modified values you want and the flag IS_PENDING
set to 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With