Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android 13 Photo / Video Picker - file name from the URI is garbage

Tags:

android

When using the picker introduced with Android 13 via ActivityResultContracts.PickVisualMedia a Uri is returned (representing the selected media item):

content://media/picker/0/com.android.providers.media.photopicker/media/1000000198

If I use the content resolver and interrogate the cursor I get something like:

duration = 38003
orientation = 0
height = 2336
_display_name = 1000000198.mp4
datetaken = 1681826421000
mime_type = video/mp4
_data = /sdcard/.transforms/synthetic/picker/0/com.android.providers.media.photopicker/media/1000000198.mp4
_size = 9920806
width = 1072

The column usually used for the filename is OpenableColumns.DISPLAY_NAME (_display_name). However as you can tell the values here are just some garbage number filename and not the actual filename that was selected. This is NOT the actual filename of the selected video.

Is there any way to use this Android 13 photo/video picker and get the actual filename of the file the user selected and not this garbage number filename?

like image 565
Matt Avatar asked Dec 20 '25 03:12

Matt


1 Answers

From my personal research I don't think it's possible to get the file/display name from the Photo Picker.

This is an open issue (at the time of writing) and Google hasn't responded to the request yet.

The only options I see at the moment are either accepting that we don't get the filename and hoping for a fix in the future or implementing your own file/photo picker (which then of course needs extra permissions because it's not a system app)

like image 70
jhain Avatar answered Dec 21 '25 19:12

jhain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!