Questions tagged [android-mediascanner]

The MediaScannerConnection class provides a way for applications to pass a newly created or downloaded media file to the media scanner service

The MediaScannerConnection class provides a way for applications to pass a newly created or downloaded media file to the media scanner service. The media scanner service will read metadata from the file and add the file to the media content provider. The MediaScannerConnectionClient provides an interface for the media scanner service to return the Uri for a newly scanned file to the client of the MediaScannerConnection class.

Class API: http://developer.android.com/reference/android/media/MediaScannerConnection.html

176 questions
54
votes
5 answers

Refresh Android mediastore using adb

I'm using adb to sync music on an android phone. Essentially, I rm the existing music directory and push replacement music files. I'd like to be able to use adb to force a rescan, so that the google music player (and other apps) works properly with…
foosion
  • 7,619
  • 25
  • 65
  • 102
33
votes
9 answers

how to add images to android emulator?

any one guide me how to add some images to emulator image gallery?
UMAR-MOBITSOLUTIONS
  • 77,236
  • 95
  • 209
  • 278
16
votes
1 answer

how to run media scanner in android

I want run the media scanner while capturing the image. After capturing, the image it is updated in grid view. For that I need to run media scanner. I found two solutions to run media scanner one is the broadcast event and other one is running…
15
votes
6 answers

Trigger mediascanner on specific path (folder), how to?

I got this class: import android.content.Context; import android.media.MediaScannerConnection; import android.net.Uri; import android.util.Log; public class MediaScannerWrapper implements MediaScannerConnection.MediaScannerConnectionClient { …
Bigflow
  • 3,616
  • 5
  • 29
  • 52
14
votes
4 answers

Add image to Media Gallery - Android

I am trying to add a new image to the gallery. I pick an already existing image though an intent and then resize and compress it. Then I store the resulting bitmap: public static File compressAndSaveImage(Context ctx, Uri imageUri) throws…
parakmiakos
  • 2,994
  • 9
  • 29
  • 43
13
votes
6 answers

Scan Android SD card for new files

My app allows a user to save an image to their SD card. But I'm not sure how to make it appear in the gallery until you unmount and remount the SD card. I have googled for a couple of days with this problem but am not sure how to make it appear…
Brian
  • 819
  • 4
  • 20
  • 35
13
votes
2 answers

Android MediaScanner: Remove image file(s) from gallery

I am developing an app which hides image files in stock gallery app. For the same, I am creating a .nomedia file and asking MediaScanner to update. This technique works for a case where I have to show the hidden files, i.e. delete .nomedia file and…
13
votes
3 answers

How to get notified of each new image being visible to the gallery app?

Background When the user downloads a new image or captures one using the camera, the gallery app will get updated to show the new images. I need to be notified of each new image as soon as it was created, no matter how it was created (camera,…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
13
votes
2 answers

Observing changes in Android content observer for Audio.Media.EXTERNAL_CONTENT_URI

I am developing an Android app in which I have to detect changes in Android SD card for audio files with the file name, file path and operation performed upon it. Example if I am adding a file in my SD card then I want to know Name of the file…
12
votes
1 answer

How to force a MediaStore update for a file using only its Content Uri

In Android Q the field MediaStore.Files.FileColumns.DATA has been deprecated, and may be Null or apps have no rights to read it when targeting such OS version, so will be preferable to work using only a file’s content Uri. Since the…
PerracoLabs
  • 16,449
  • 15
  • 74
  • 127
11
votes
5 answers

Android's Media Scanner: How do I remove files?

I'm writing an app that removes files that may or may not be listed in any one of the types of media libraries such as music or pictures. While I can use the MediaScannerConnection.scanFile method to add files to the media library there doesn't seem…
Spencer Ruport
  • 34,865
  • 12
  • 85
  • 147
11
votes
4 answers

Insert Video to gallery [Android Q]

To record a SurfeceView I'm using a 3rd-party library , this library requires a path where the output (the recorded video) saved in my case is savedVideoPath : mRenderPipeline = EZFilter.input(this.effectBmp) .addFilter(new…
10
votes
2 answers

Manual add song to Mediastore as a music track

I want to create a Music player which can download a song online and add it to MediaStore. I'm using Download Manager and allow MediaScanner scan this file when download completed. DownloadManager.Request request…
Khang .NT
  • 1,504
  • 6
  • 24
  • 46
10
votes
2 answers

Android ACTION_MEDIA_SCANNER_SCAN_FILE not showing image until reboot?

I am currently developing an Android Application where users take pictures which are stored in External Memory on the device then I am trying to also get the Gallery to scan the file to add the new media to the Gallery however this does not seem to…
MonkeyBlue
  • 2,234
  • 6
  • 31
  • 41
10
votes
5 answers

How to refresh Gallery after deleting image from SDCard

When deleting the images on Android’s SD Card, sometimes the images are correctly removed but in the gallery still remains a preview of the removed image. When tapping on it, it is loaded as a black image. To resolve it I need to run MediaScanner.…
AndroidDev
  • 4,521
  • 24
  • 78
  • 126
1
2 3
11 12