How to update metadata of audio file in Android Q media store?

后端 未结 3 508
夕颜
夕颜 2020-12-09 22:52

Updating metadata of audio file in media store is not working in Android Q OS, it works in all other OS.

I am using content provider with uri specified as MediaStore

3条回答
  •  眼角桃花
    2020-12-09 23:32

    I've been updating meta data in the MediaStore through a ContentResolver, but this no longer works with Android Q (API 29). The following code gives me a warning, and the description is not updated:

    ContentValues values = new ContentValues();
    values.put(MediaStore.Images.Media.DESCRIPTION, "Some text");
    
    res = getContext().getContentResolver().update(
            MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
            values,
            MediaStore.Images.Media._ID + "= ?", new String[]{sImageId});
    

    android.process.media W/MediaProvider: Ignoring mutation of description from com.example.android.someapp.app

    This Medium post describes how Google has changed the API for accessing and updating files, but what about updating just the meta data? The warning seems to tell me Google no longer wants to allow third party apps to use the MediaStore, and I also found where the warning comes from:  https://android.googlesource.com/platform/packages/providers/MediaProvider/+/master/src/com/android/providers/media/MediaProvider.java#2960

提交回复
热议问题