Questions tagged [mediastore]

The MediaStore provider contains meta data for all available media on both internal and external storage devices.

mediastore
Filter by
Sorted by
Tagged with
2 votes
1 answer
524 views

Cursor returns 0 when fetched Video content from MediaStore in Android

I am trying to retrieve the Video content from MediaStore.Video in Android 11. Cursor is returning "0" with below code. I added READ_EXTERNAL_STORAGE permission in manifest file and also ...
Chait's user avatar
  • 597
0 votes
0 answers
283 views

How to rename Folder (Bucket Display Name) in android using Mediastore APIs

I am using Mediastore to retrieve Videos and I also group them by "Bucket Display Name". the problem is, I can rename or delete a video as i have their IDs and URIs. But i am stuck in doing ...
Nasib's user avatar
  • 1,365
0 votes
0 answers
146 views

How to check if a file is stored on the SD Card using MediaStore?

I made an audio player app and I'm using mediastore queries to load the audio files. I can group them by folder but now I want to render the files stored on the SD Card in a different way. I could not ...
Arpad Toth's user avatar
0 votes
1 answer
5k views

java.lang.IllegalArgumentException: All requested items must be referenced by specific ID (Android)

I'm getting this exception upon calling MediaStore.createWriteRequest(contentResolver, uris). As in Anrdroid Q and above we have to make createWriteRequest to write on storage. So I'm trying the ...
Feroz Khan's user avatar
  • 2,696
0 votes
1 answer
485 views

How to set codec to H.264 in `MediaStore.ACTION_VIDEO_CAPTURE` ? ( Android )

I would like to record a video and send it to the server. It has to be H.264 mp4, so the server does not have to convert it, and it can be displayed on the web. This is how I currently create the ...
Iter Ator's user avatar
  • 8,598
0 votes
0 answers
242 views

Saving an audio file with Mediastore API throws RemoteException on API 28-

I didn't find any official documentation explaining how to save an audio file on the external storage with the MediaStore API. On API 29+ everything works. On API 28- I get this error: E/JavaBinder: **...
iClaude's user avatar
  • 717
6 votes
1 answer
1k views

Is MediaStore.MediaColumns#DATE_TAKEN only available from API level 29?

I am trying to use MediaStore.Images.Media.DATE_TAKEN and getting warning from Android Studio IDE that it requires API 29 (Android Q). The official Google documentation here says this was Added in API ...
avelyne's user avatar
  • 750
1 vote
0 answers
48 views

Android Camera saving image, but not sure where it is being saved

I am stuck in a bit of a problem, my android studio application has a custom camera interface, it is able to save its images by calling the MediaStore.Images.Media.insertImage(...
CodingNoob120031's user avatar
0 votes
1 answer
575 views

how to show media files on recycler view from a specific device folder

Hello Guys need a help This is my requirement:- I have a folder in my device there are different types of files in that wanna load these all files on a recycler view (only display) Please guide me I ...
Tayyab Husain's user avatar
1 vote
0 answers
772 views

Get all files from external storage (including Downloads folder) on Android 10+

I'm trying to get all files from external storage. The problem is with the Downloads folder. MediaStore.Downloads returns only files that were created by my app. I found this article: https://...
Serhii K.'s user avatar
  • 669
0 votes
1 answer
486 views

I want to load all images from my gallery but my cursor return false when i am calling cursor.moveToFirst()

My Code : public void loadImageFromStorage(Context context,Activity activity){ Uri uri=null; Uri uriExternal= MediaStore.Images.Media.EXTERNAL_CONTENT_URI; int colIndexId; /////////...
Aman Dalal's user avatar
0 votes
1 answer
184 views

Delete a file in Android when you have a path of form `/storage/1018-2710/Pictures/oLvCVPZrNxk.jpg`

So I am trying to delete a file from Android External storage, the problem is, I've tried getting the path multiple times in multiple different ways. Using MediaStore Api I've come really close but ...
Nikola-Milovic's user avatar
1 vote
1 answer
2k views

MediaStore returns null when querying for DISPLAY_NAME

In some rare situations, MediaStore returns null when trying to query for MediaStore.Video.VideoColumns.DISPLAY_NAME using the following code snippet String displayName = cursor.getString(cursor....
mahdi's user avatar
  • 790
2 votes
1 answer
644 views

How to pick video or image from gallery and get its path according to Android 10 (API Level 29) as Mediastore.Video.Media.DATA is deprecated

I'm trying to pick video from gallery and want to get it's real path. But in the code it's showing Mediastore.Video.Media.DATA id deprecated in API Level 29. So please help me to find out the solution....
Geek Tanmoy's user avatar
3 votes
1 answer
727 views

How to get images from phone on API below 29

I develop image gallery app for Android (min sdk 23, target sdk 29). And I trying to get list of photos from the phone. Here the code: val list: MutableList<Photo> = mutableListOf() val ...
pilot's user avatar
  • 51
1 vote
2 answers
2k views

Unable to get all Video files from storage Android

Am using following method to get video files from storage. it retrieves only directories files but not read files inside sub-directory files. Example:- i can read file from WhatsApp Video but in the ...
sanoj lawrence's user avatar
1 vote
2 answers
297 views

How to put the taken photos in RecyclerView in Kotlin

My application uses the camera to take pictures and then saves them in the MediaStore. I would like to put these pictures in my RecyclerView using Glide but I don't know how to do it. A function that ...
MathhewCiech's user avatar
6 votes
1 answer
5k views

Android 11 Media store - cannot record new videos on relative path. It works with Environment.DIRECTORY_MOVIES path but not not with sub folder

My code runs perfect on any Android lower then Android 11. On Android 11 (specifically on Pixel2 & Pixel3 emulator and real devices) the file descriptor fail to find the file after inserting it to ...
kfir's user avatar
  • 695
2 votes
0 answers
521 views

Android 11 - Mediastore playlist remove multiple tracks from Playlist

On Android 11, when trying to remove multiple tracks from a Playlist, all the tracks are removed instead of just the selected ones. This used to work fine till Android 10. However, if only 1 track is ...
Siju's user avatar
  • 2,605
3 votes
0 answers
340 views

Select Videos By Its Folder Name MediaStore

I am creating a video player app, and i done most of the parts but when i started implementing the folder part to show all videos present in a specific folder through MediaStore it gives me result ...
Md Aman's user avatar
  • 340
2 votes
0 answers
503 views

Unable to list all pdf files on device on android 10 and above

Due to changes in storage framework, I am unable to list all the pdf files on the device. This is my code : String pdf = MimeTypeMap.getSingleton().getMimeTypeFromExtension("pdf"); Uri table ...
Abhishek Kumar's user avatar
1 vote
1 answer
1k views

How to save to Media folder via Mediastore in CameraX?

I am still new to android programming. I am trying to take a photo using CameraX API. However, the sample code at Google Codelabs only saves the photo on the app's private directory in compliance with ...
Kellin Strook's user avatar
0 votes
0 answers
1k views

Android save media to gallery MediaStoreApi

I am using this code to save file to gallery by using MediaStoreApi. It works well on Android api level 29 and higher, but it fails on android api level 28 and lower. Any solution by using ...
nAkhmedov's user avatar
  • 3,582
0 votes
1 answer
1k views

MediaStore: After updating the file which is created by my app it cannot be deleted easily

Next code for deleting a file which my app owns works ok, there is no exception RecoverableSecurityException because the file was created by my app (using ContentResolver.insert(...) method) ...
user924's user avatar
  • 10.4k
0 votes
0 answers
109 views

Alternate solution to MediaStore DATE_TAKEN

I'm using MediaStore.MediaColumns.DATE_TAKEN in my application. The date taken is accurate for existing images. However, for the newly added images, it would show up as Jan 1, 1970. What's even more ...
Siddharth Kamaria's user avatar
0 votes
3 answers
2k views

Android Studio - Trying to Read MP3 FIles from the Music Directory on Android Device

I have a function below that I got from a post on here, where I am trying to read the music files from the device. public List<AudioModel> getAllAudioFromDevice(final Context context) { ...
OptimusPrime's user avatar
1 vote
0 answers
454 views

How to save video to gallery and retrieve the saved video uri?

I am trying to make a save to gallery feature for my app. My app's minimum api level is 21 and max 30. Here is the code I am using for saving video to gallery. Everything works perfect but the code ...
WebDiva's user avatar
  • 161
0 votes
0 answers
113 views

Adding in-app shortcut to file, anywhere on file system, when targeting Android 10/11 and using Scoped Storage (or not!)

I want to let the user select a file on his filesystem (any type ideally), be it on internal memory, external sd cards or on a cloud service (using the filechooser) I know that with scoped storage ...
Sean Blahovici's user avatar
0 votes
1 answer
158 views

Unable to list parent directory from file path

In my code am trying to collect all video file in list and warp it inside there parent directory and display it inside recycler view, And while displaying i get a folder name 0 i don't understand ...
sanoj lawrence's user avatar
2 votes
2 answers
1k views

Do we need permission to get all files that is self-created by the app after the app is reinstalled in AndroidQ?

Use-Case: Here, I can create and save files in local storage using MediaStore and get all the files from MediaStore. But Once I clear-storage or reinstall the app, the files will no longer be ...
jazzbpn's user avatar
  • 6,918
6 votes
3 answers
6k views

Rename file of the Mediastore which is created by app in android 10. Working on Android API 30 but shows error in API 29

Here, this renameFile(..) func is working in Android API 30. But, it is not working in Android API 29 and shows the error like : java.lang.IllegalArgumentException: Movement of content://media/...
jazzbpn's user avatar
  • 6,918
1 vote
1 answer
3k views

How to read Image from a specific folder on Android 10 using MediaStore

I'm trying to read Image from DCIM/Folder_Name(the location where the app saves image ).I need to display the image like a gallery only from that Folder_Name. I tried using MediaStore with query and ...
Ajith Selvan's user avatar
1 vote
1 answer
3k views

How to get all PDF files Uri with FileName from external storage in Android 10 using java

I am trying to list all the PDF files from the external storage created by the app. How to list pdf files in the App after iterating through cursor? private void getExternalPDFFiles() { ...
jazzbpn's user avatar
  • 6,918
2 votes
1 answer
9k views

How to save pdf file in a Media Store in Android 10 and above using JAVA?

UPDATE: In order to save PDF file: in the answer section below. In order to save bitmap file: @RequiresApi(api = Build.VERSION_CODES.Q) @NonNull private Uri saveBitmap(@NonNull final Context context, @...
jazzbpn's user avatar
  • 6,918
5 votes
1 answer
4k views

How can I read File from MediaStore in Relative Path?

In Android 10 or higher, I used MediaStore to save files in Downloads, shared storage. The code I used to save the file is as follows: GlobalScope.launch { val values = ContentValues()....
rosered65's user avatar
0 votes
0 answers
268 views

Android API 19+: sometimes no type in DocumentsContract.getDocumentId from image and it cannot be found with id

We're trying to load images with a pick intent: Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); intent.putExtra(Intent....
Thomas's user avatar
  • 1
0 votes
0 answers
837 views

How to save a video by MediaStore on Android Q

I write this function to insert a video file: @RequiresApi(Build.VERSION_CODES.Q) private fun String.insertQ(url: Uri, bucketName: String, subDir: String): Uri? { return contentResolver.insert(url,...
suikajy's user avatar
  • 23
2 votes
0 answers
144 views

Is DATA Column in MediaStore Of Android Not Deprecated Yet?

I just want to know why mediastore data is not deprecated yet when i write in codes of android studio it does not show any warnings regarding that column. But developer site says this column (DATA) is ...
Md Aman's user avatar
  • 340
5 votes
1 answer
3k views

VOLUME_EXTERNAL require API level 29

In Android documentation they said On API <= 28, use VOLUME_EXTERNAL but this also requires API level 29, and it doesn't save media files into MediaStore. MediaStore.Audio.Media.IS_PENDING ...
Gunaseelan's user avatar
  • 15.1k
0 votes
0 answers
308 views

Get info of images after saving them using MediaStore in Android 10 & above

In my app, I am using the below code to allow users to select multiple images. val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply { addCategory(Intent.CATEGORY_OPENABLE) type = &...
Mehul Kanzariya's user avatar
1 vote
0 answers
2k views

How to save an audio file using MediaStore API

I want to download an audio file from firebase storage and then save it in the device so that any other app or music player (and my app later) can access and play. The Documentation says that all ...
ameencarpenter's user avatar
0 votes
0 answers
701 views

ContentResolver query doesn't return the newly inserted video

I have inserted new video in MediaStore like this, val resolver = requireActivity().applicationContext.contentResolver val videoCollection = MediaStore.Video.Media.getContentUri(MediaStore....
Gunaseelan's user avatar
  • 15.1k
1 vote
1 answer
583 views

Android 10 scoped storage how to delete the underlying image file in a shared directory

I'm using scoped storage and MediaStore content provider like the in the documents. The problem is that the underlying files are not being deleted. (I have yet to see a question specifically on this ...
funct7's user avatar
  • 3,497
3 votes
1 answer
3k views

How can I list all the files in directory using Medistore (Android 10/Q)?

I want to query all of the files in a folder called as memories through the Mediastore API. I have tried looking at these questions but didn't get an appropriate answer. https://android.jlelse.eu/...
Mood Board's user avatar
0 votes
0 answers
157 views

MediaStore.Images.Media does not delete the moved image entry

I've moved a picture from Download directory to DCIM by the app named 'Files'. Cursor gets both, new and old paths. getApplication<Application>().applicationContext.contentResolver.query( ...
Vsevolod's user avatar
  • 357
0 votes
1 answer
361 views

Why is ALBUM_ART the only field that returns null from MediaStore when others are fine?

I'm having trouble retrieving the album artwork path. My storage permissions can't be the problem since I can fetch all other fields, so I'm wondering what the problem might be. I'll admit I'm a bit ...
Ryuji Komai's user avatar
4 votes
0 answers
364 views

React native mediaStore public photos

I have an app which allows you to store photos and videos like a diary. These are stored in public directories so that other apps can access and view these such as the standard photos app. Also so ...
BeginnerDBADan's user avatar
0 votes
0 answers
173 views

Storing Audio file using MediaStore fails on setting TITLE, ARTIST, COMPOSER etc

I am using the Android MediaRecorder to create a new voice recording as an mp3 file by using the latest MediaStore Audio APIs. The properties of the new file is set using the following code. val ...
abat 's user avatar
  • 655
12 votes
3 answers
12k views

java.lang.IllegalArgumentException Volume external_primary not found in Android 10 devices

Crash : java.lang.IllegalArgumentException Volume external_primary not found When querying for tracks from media store, I am getting this crash in some Android 10 devices (Most of them are from Xiaomi ...
AndroidDev's user avatar
  • 1,555
2 votes
1 answer
266 views

Video will not show up in Photos on Android 24 using FileProvider and MediaScan

I am kind of stuck on this one and have been working on it for a little while with no luck. I have an android application which allows the user to take photos/videos. The files are stored on external ...
James Williams's user avatar

1
5 6
7
8 9
23