In Android Q the MediaStore.Files.FileColumns.DATA field has been deprecated, and may be null or apps may not have the rights to read it, therefore is there a way to rename the filename section (not the path) of a file using only its media content Uri?
Until now the DATA field could be used to find the real path of a file from a known Uri, but since it has been deprecated then the idea is not to even try to find or resolve the real file path, and use only its content Uri.
Consider that the Uri will be in the standard media content format (not SAF): content://media/external/images/media/123
The intention is to rename the name of the file that the Uri is pointing to.
I’m aware that I can update the MediaStore’s TITLE and DISPLAY_NAME fields, but this doesn’t change the file name, and if a user decides to move the file outside the device then this one will still have the old filename.
from How to rename a file in Android knowing only its media content Uri
No comments:
Post a Comment