# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Nested Classes | Constants | Fields | Ctors | Methods | Inherited Methods

# MediaStore

`public final class MediaStore`
`extends Object` ``

java.lang.Object
↳ | android.provider.MediaStore

The contract between the media provider and applications. Contains definitions for the supported URIs and columns.

The media provider provides an indexed collection of common media types, such as `Audio`, `Video`, and `Images`, from any attached storage devices. Each collection is organized based on the primary MIME type of the underlying content; for example, `image/*` content is indexed under `Images`. The `Files` collection provides a broad view across all collections, and does not filter by MIME type.

## Summary

### Nested classes
`class` | `MediaStore.Audio` Collection of all media with MIME type of `audio/*`.
`interface` | `MediaStore.DownloadColumns` Download metadata columns.
`class` | `MediaStore.Downloads` Collection of downloaded items.
`class` | `MediaStore.Files` Media provider table containing an index of all files in the media storage, including non-media files.
`class` | `MediaStore.Images` Collection of all media with MIME type of `image/*`.
`interface` | `MediaStore.MediaColumns` Common media metadata columns.
`class` | `MediaStore.Video` Collection of all media with MIME type of `video/*`.

### Constants
`String` | `ACTION_IMAGE_CAPTURE` Standard Intent action that can be sent to have the camera application capture an image and return it.
`String` | `ACTION_IMAGE_CAPTURE_SECURE` Intent action that can be sent to have the camera application capture an image and return it when the device is secured (e.g. with a pin, password, pattern, or face unlock).
`String` | `ACTION_REVIEW` Standard action that can be sent to review the given media file.
`String` | `ACTION_REVIEW_SECURE` Standard action that can be sent to review the given media file when the device is secured (e.g. with a pin, password, pattern, or face unlock).
`String` | `ACTION_VIDEO_CAPTURE` Standard Intent action that can be sent to have the camera application capture a video and return it.
`String` | `AUTHORITY` The authority for the media provider
`String` | `EXTRA_BRIGHTNESS` When defined, the launched application is requested to set the given brightness value via `WindowManager.LayoutParams.screenBrightness` to help ensure a smooth transition when launching `ACTION_REVIEW` or `ACTION_REVIEW_SECURE` intents.
`String` | `EXTRA_DURATION_LIMIT` Specify the maximum allowed recording duration in seconds.
`String` | `EXTRA_FINISH_ON_COMPLETION` The name of the Intent-extra used to control the onCompletion behavior of a MovieView.
`String` | `EXTRA_FULL_SCREEN` The name of an Intent-extra used to control the UI of a ViewImage.
`String` | `EXTRA_MEDIA_ALBUM` The name of the Intent-extra used to define the album
`String` | `EXTRA_MEDIA_ARTIST` The name of the Intent-extra used to define the artist
`String` | `EXTRA_MEDIA_FOCUS` The name of the Intent-extra used to define the search focus.
`String` | `EXTRA_MEDIA_GENRE` The name of the Intent-extra used to define the genre.
`String` | `EXTRA_MEDIA_PLAYLIST` The name of the Intent-extra used to define the playlist.
`String` | `EXTRA_MEDIA_RADIO_CHANNEL` The name of the Intent-extra used to define the radio channel.
`String` | `EXTRA_MEDIA_TITLE` The name of the Intent-extra used to define the song title
`String` | `EXTRA_OUTPUT` The name of the Intent-extra used to indicate a content resolver Uri to be used to store the requested image or video.
`String` | `EXTRA_SCREEN_ORIENTATION` The name of the Intent-extra used to control the orientation of a ViewImage or a MovieView.
`String` | `EXTRA_SHOW_ACTION_ICONS` The name of an Intent-extra used to control the UI of a ViewImage.
`String` | `EXTRA_SIZE_LIMIT` Specify the maximum allowed size.
`String` | `EXTRA_VIDEO_QUALITY` The name of the Intent-extra used to control the quality of a recorded video.
`String` | `INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH` An intent to perform a search for music media and automatically play content from the result when possible.
`String` | `INTENT_ACTION_MEDIA_SEARCH` Activity Action: Perform a search for media.
`String` | `INTENT_ACTION_MUSIC_PLAYER` This constant is deprecated. Use `Intent.CATEGORY_APP_MUSIC` instead.
`String` | `INTENT_ACTION_STILL_IMAGE_CAMERA` The name of the Intent action used to launch a camera in still image mode.
`String` | `INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE` The name of the Intent action used to launch a camera in still image mode for use when the device is secured (e.g. with a pin, password, pattern, or face unlock).
`String` | `INTENT_ACTION_TEXT_OPEN_FROM_SEARCH` An intent to perform a search for readable media and automatically play content from the result when possible.
`String` | `INTENT_ACTION_VIDEO_CAMERA` The name of the Intent action used to launch a camera in video mode.
`String` | `INTENT_ACTION_VIDEO_PLAY_FROM_SEARCH` An intent to perform a search for video media and automatically play content from the result when possible.
`int` | `MATCH_DEFAULT` Value indicating that the default matching behavior should be used, as defined by the key documentation.
`int` | `MATCH_EXCLUDE` Value indicating that operations should exclude items matching the criteria defined by this key.
`int` | `MATCH_INCLUDE` Value indicating that operations should include items matching the criteria defined by this key.
`int` | `MATCH_ONLY` Value indicating that operations should only operate on items explicitly matching the criteria defined by this key.
`String` | `MEDIA_IGNORE_FILENAME` Name of the file signaling the media scanner to ignore media in the containing directory and its subdirectories.
`String` | `MEDIA_SCANNER_VOLUME` Name of current volume being scanned by the media scanner.
`String` | `META_DATA_REVIEW_GALLERY_PREWARM_SERVICE` Name under which an activity handling `ACTION_REVIEW` or `ACTION_REVIEW_SECURE` publishes the service name for its prewarm service.
`String` | `META_DATA_STILL_IMAGE_CAMERA_PREWARM_SERVICE` Name under which an activity handling `INTENT_ACTION_STILL_IMAGE_CAMERA` or `INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE` publishes the service name for its prewarm service.
`String` | `QUERY_ARG_MATCH_FAVORITE` Specify how `MediaColumns#IS_FAVORITE` items should be filtered when performing a `MediaStore` operation.
`String` | `QUERY_ARG_MATCH_PENDING` Specify how `MediaColumns#IS_PENDING` items should be filtered when performing a `MediaStore` operation.
`String` | `QUERY_ARG_MATCH_TRASHED` Specify how `MediaColumns#IS_TRASHED` items should be filtered when performing a `MediaStore` operation.
`String` | `QUERY_ARG_RELATED_URI` Specify a `Uri` that is "related" to the current operation being performed.
`String` | `UNKNOWN_STRING` The string that is used when a media attribute is not known.
`String` | `VOLUME_EXTERNAL` Synthetic volume name that provides a view of all content across the "external" storage of the device.
`String` | `VOLUME_EXTERNAL_PRIMARY` Specific volume name that represents the primary external storage device at `Environment#getExternalStorageDirectory()`.
`String` | `VOLUME_INTERNAL` Synthetic volume name that provides a view of all content across the "internal" storage of the device.

### Fields
`public static final Uri` | `AUTHORITY_URI` A content:// style uri to the authority for the media provider

### Public constructors
`MediaStore()`

### Public methods
`static PendingIntent` | `createDeleteRequest(ContentResolver resolver, Collection<Uri> uris)` Create a `PendingIntent` that will prompt the user to permanently delete the requested media items.
`static PendingIntent` | `createFavoriteRequest(ContentResolver resolver, Collection<Uri> uris, boolean value)` Create a `PendingIntent` that will prompt the user to favorite the requested media items.
`static PendingIntent` | `createTrashRequest(ContentResolver resolver, Collection<Uri> uris, boolean value)` Create a `PendingIntent` that will prompt the user to trash the requested media items.
`static PendingIntent` | `createWriteRequest(ContentResolver resolver, Collection<Uri> uris)` Create a `PendingIntent` that will prompt the user to grant your app write access for the requested media items.
`static Uri` | `getDocumentUri(Context context, Uri mediaUri)` Return a `DocumentsProvider` Uri that is an equivalent to the given `MediaStore` Uri.
`static Set<String>` | `getExternalVolumeNames(Context context)` Return list of all specific volume names that make up `VOLUME_EXTERNAL`.
`static long` | `getGeneration(Context context, String volumeName)` Return the latest generation value for the given volume.
`static Uri` | `getMediaScannerUri()` Uri for querying the state of the media scanner.
`static Uri` | `getMediaUri(Context context, Uri documentUri)` Return a `MediaStore` Uri that is an equivalent to the given `DocumentsProvider` Uri.
`static Set<String>` | `getRecentExternalVolumeNames(Context context)` Return list of all recent volume names that have been part of `VOLUME_EXTERNAL`.
`static boolean` | `getRequireOriginal(Uri uri)` Return if the caller requires the original file contents when calling `ContentResolver#openFileDescriptor(Uri, String)`.
`static String` | `getVersion(Context context, String volumeName)` Return an opaque version string describing the `MediaStore` state.
`static String` | `getVersion(Context context)` Return an opaque version string describing the `MediaStore` state.
`static String` | `getVolumeName(Uri uri)` Return the volume name that the given `Uri` references.
`static Uri` | `setIncludePending(Uri uri)` This method is deprecated. consider migrating to `QUERY_ARG_MATCH_PENDING` which is more expressive.
`static Uri` | `setRequireOriginal(Uri uri)` Update the given `Uri` to indicate that the caller requires the original file contents when calling `ContentResolver#openFileDescriptor(Uri, String)`.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Constants

### ACTION_IMAGE_CAPTURE

    public static final String ACTION_IMAGE_CAPTURE

Standard Intent action that can be sent to have the camera application capture an image and return it.

The caller may pass an extra EXTRA_OUTPUT to control where this image will be written. If the EXTRA_OUTPUT is not present, then a small sized image is returned as a Bitmap object in the extra field. This is useful for applications that only need a small image. If the EXTRA_OUTPUT is present, then the full-sized image will be written to the Uri value of EXTRA_OUTPUT. As of `Build.VERSION_CODES.LOLLIPOP`, this uri can also be supplied through `Intent.setClipData(ClipData)`. If using this approach, you still must supply the uri through the EXTRA_OUTPUT field for compatibility with old applications. If you don't set a ClipData, it will be copied there for you when calling `Context#startActivity(Intent)`.

Note: if you app targets `M` and above and declares as using the `Manifest.permission.CAMERA` permission which is not granted, then attempting to use this action will result in a `SecurityException`.

See also:

- `EXTRA_OUTPUT`

Constant Value: "android.media.action.IMAGE_CAPTURE"

### ACTION_IMAGE_CAPTURE_SECURE

    public static final String ACTION_IMAGE_CAPTURE_SECURE

Intent action that can be sent to have the camera application capture an image and return it when the device is secured (e.g. with a pin, password, pattern, or face unlock). Applications responding to this intent must not expose any personal content like existing photos or videos on the device. The applications should be careful not to share any photo or video with other applications or Internet. The activity should use `Activity#setShowWhenLocked` to display on top of the lock screen while secured. There is no activity stack when this flag is used, so launching more than one activity is strongly discouraged.

The caller may pass an extra EXTRA_OUTPUT to control where this image will be written. If the EXTRA_OUTPUT is not present, then a small sized image is returned as a Bitmap object in the extra field. This is useful for applications that only need a small image. If the EXTRA_OUTPUT is present, then the full-sized image will be written to the Uri value of EXTRA_OUTPUT. As of `Build.VERSION_CODES.LOLLIPOP`, this uri can also be supplied through `Intent.setClipData(ClipData)`. If using this approach, you still must supply the uri through the EXTRA_OUTPUT field for compatibility with old applications. If you don't set a ClipData, it will be copied there for you when calling `Context#startActivity(Intent)`.

See also:

- `ACTION_IMAGE_CAPTURE`
- `EXTRA_OUTPUT`

Constant Value: "android.media.action.IMAGE_CAPTURE_SECURE"

### ACTION_REVIEW

    public static final String ACTION_REVIEW

Standard action that can be sent to review the given media file.

The launched application is expected to provide a large-scale view of the given media file, while allowing the user to quickly access other recently captured media files.

Input: `Intent#getData` is URI of the primary media item to initially display.

See also:

- `ACTION_REVIEW_SECURE`
- `EXTRA_BRIGHTNESS`

Constant Value: "android.provider.action.REVIEW"

### ACTION_REVIEW_SECURE

    public static final String ACTION_REVIEW_SECURE

Standard action that can be sent to review the given media file when the device is secured (e.g. with a pin, password, pattern, or face unlock). The applications should be careful not to share any media with other applications or Internet. The activity should use `Activity#setShowWhenLocked` to display on top of the lock screen while secured. There is no activity stack when this flag is used, so launching more than one activity is strongly discouraged.

The launched application is expected to provide a large-scale view of the given primary media file, while only allowing the user to quickly access other media from an explicit secondary list.

Input: `Intent#getData` is URI of the primary media item to initially display. `Intent#getClipData` is the limited list of secondary media items that the user is allowed to review. If `Intent#getClipData` is undefined, then no other media access should be allowed.

See also:

- `EXTRA_BRIGHTNESS`

Constant Value: "android.provider.action.REVIEW_SECURE"

### ACTION_VIDEO_CAPTURE

    public static final String ACTION_VIDEO_CAPTURE

Standard Intent action that can be sent to have the camera application capture a video and return it.

The caller may pass in an extra EXTRA_VIDEO_QUALITY to control the video quality.

The caller may pass in an extra EXTRA_OUTPUT to control where the video is written. If EXTRA_OUTPUT is not present the video will be written to the standard location for videos, and the Uri of that location will be returned in the data field of the Uri. As of `Build.VERSION_CODES.LOLLIPOP`, this uri can also be supplied through `Intent.setClipData(ClipData)`. If using this approach, you still must supply the uri through the EXTRA_OUTPUT field for compatibility with old applications. If you don't set a ClipData, it will be copied there for you when calling `Context#startActivity(Intent)`.

Note: if you app targets `M` and above and declares as using the `Manifest.permission.CAMERA` permission which is not granted, then atempting to use this action will result in a `SecurityException`.

See also:

- `EXTRA_OUTPUT`
- `EXTRA_VIDEO_QUALITY`
- `EXTRA_SIZE_LIMIT`
- `EXTRA_DURATION_LIMIT`

Constant Value: "android.media.action.VIDEO_CAPTURE"

### AUTHORITY

    public static final String AUTHORITY

The authority for the media provider

Constant Value: "media"

### EXTRA_BRIGHTNESS

    public static final String EXTRA_BRIGHTNESS

When defined, the launched application is requested to set the given brightness value via `WindowManager.LayoutParams.screenBrightness` to help ensure a smooth transition when launching `ACTION_REVIEW` or `ACTION_REVIEW_SECURE` intents.

Constant Value: "android.provider.extra.BRIGHTNESS"

### EXTRA_DURATION_LIMIT

    public static final String EXTRA_DURATION_LIMIT

Specify the maximum allowed recording duration in seconds.

Constant Value: "android.intent.extra.durationLimit"

### EXTRA_FINISH_ON_COMPLETION

    public static final String EXTRA_FINISH_ON_COMPLETION

The name of the Intent-extra used to control the onCompletion behavior of a MovieView. This is a boolean property that specifies whether or not to finish the MovieView activity when the movie completes playing. The default value is true, which means to automatically exit the movie player activity when the movie completes playing.

Constant Value: "android.intent.extra.finishOnCompletion"

### EXTRA_FULL_SCREEN

    public static final String EXTRA_FULL_SCREEN

The name of an Intent-extra used to control the UI of a ViewImage. This is a boolean property that overrides the activity's default fullscreen state.

Constant Value: "android.intent.extra.fullScreen"

### EXTRA_MEDIA_ALBUM

    public static final String EXTRA_MEDIA_ALBUM

The name of the Intent-extra used to define the album

Constant Value: "android.intent.extra.album"

### EXTRA_MEDIA_ARTIST

    public static final String EXTRA_MEDIA_ARTIST

The name of the Intent-extra used to define the artist

Constant Value: "android.intent.extra.artist"

### EXTRA_MEDIA_FOCUS

    public static final String EXTRA_MEDIA_FOCUS

The name of the Intent-extra used to define the search focus. The search focus indicates whether the search should be for things related to the artist, album or song that is identified by the other extras.

Constant Value: "android.intent.extra.focus"

### EXTRA_MEDIA_GENRE

    public static final String EXTRA_MEDIA_GENRE

The name of the Intent-extra used to define the genre.

Constant Value: "android.intent.extra.genre"

### EXTRA_MEDIA_PLAYLIST

    public static final String EXTRA_MEDIA_PLAYLIST

The name of the Intent-extra used to define the playlist.

Constant Value: "android.intent.extra.playlist"

### EXTRA_MEDIA_RADIO_CHANNEL

    public static final String EXTRA_MEDIA_RADIO_CHANNEL

The name of the Intent-extra used to define the radio channel.

Constant Value: "android.intent.extra.radio_channel"

### EXTRA_MEDIA_TITLE

    public static final String EXTRA_MEDIA_TITLE

The name of the Intent-extra used to define the song title

Constant Value: "android.intent.extra.title"

### EXTRA_OUTPUT

    public static final String EXTRA_OUTPUT

The name of the Intent-extra used to indicate a content resolver Uri to be used to store the requested image or video.

Constant Value: "output"

### EXTRA_SCREEN_ORIENTATION

    public static final String EXTRA_SCREEN_ORIENTATION

The name of the Intent-extra used to control the orientation of a ViewImage or a MovieView. This is an int property that overrides the activity's requestedOrientation.

See also:

- `ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED`

Constant Value: "android.intent.extra.screenOrientation"

### EXTRA_SHOW_ACTION_ICONS

    public static final String EXTRA_SHOW_ACTION_ICONS

The name of an Intent-extra used to control the UI of a ViewImage. This is a boolean property that specifies whether or not to show action icons.

Constant Value: "android.intent.extra.showActionIcons"

### EXTRA_SIZE_LIMIT

    public static final String EXTRA_SIZE_LIMIT

Specify the maximum allowed size.

Constant Value: "android.intent.extra.sizeLimit"

### EXTRA_VIDEO_QUALITY

    public static final String EXTRA_VIDEO_QUALITY

The name of the Intent-extra used to control the quality of a recorded video. This is an integer property. Currently value 0 means low quality, suitable for MMS messages, and value 1 means high quality. In the future other quality levels may be added.

Constant Value: "android.intent.extra.videoQuality"

### INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH

    public static final String INTENT_ACTION_MEDIA_PLAY_FROM_SEARCH

An intent to perform a search for music media and automatically play content from the result when possible. This can be fired, for example, by the result of a voice recognition command to listen to music.

This intent always includes the `EXTRA_MEDIA_FOCUS` and `SearchManager.QUERY` extras. The `EXTRA_MEDIA_FOCUS` extra determines the search mode, and the value of the `SearchManager.QUERY` extra depends on the search mode. For more information about the search modes for this intent, see Play music based on a search query in Common Intents.

This intent makes the most sense for apps that can support large-scale search of music, such as services connected to an online database of music which can be streamed and played on the device.

Constant Value: "android.media.action.MEDIA_PLAY_FROM_SEARCH"

### INTENT_ACTION_MEDIA_SEARCH

    public static final String INTENT_ACTION_MEDIA_SEARCH

Activity Action: Perform a search for media. Contains at least the `SearchManager.QUERY` extra. May also contain any combination of the following extras: EXTRA_MEDIA_ARTIST, EXTRA_MEDIA_ALBUM, EXTRA_MEDIA_TITLE, EXTRA_MEDIA_FOCUS

See also:

- `EXTRA_MEDIA_ARTIST`
- `EXTRA_MEDIA_ALBUM`
- `EXTRA_MEDIA_TITLE`
- `EXTRA_MEDIA_FOCUS`

Constant Value: "android.intent.action.MEDIA_SEARCH"

### INTENT_ACTION_MUSIC_PLAYER

    public static final String INTENT_ACTION_MUSIC_PLAYER

This constant is deprecated.
Use `Intent.CATEGORY_APP_MUSIC` instead.

Activity Action: Launch a music player. The activity should be able to play, browse, or manipulate music files stored on the device.

Constant Value: "android.intent.action.MUSIC_PLAYER"

### INTENT_ACTION_STILL_IMAGE_CAMERA

    public static final String INTENT_ACTION_STILL_IMAGE_CAMERA

The name of the Intent action used to launch a camera in still image mode.

Constant Value: "android.media.action.STILL_IMAGE_CAMERA"

### INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE

    public static final String INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE

The name of the Intent action used to launch a camera in still image mode for use when the device is secured (e.g. with a pin, password, pattern, or face unlock). Applications responding to this intent must not expose any personal content like existing photos or videos on the device. The applications should be careful not to share any photo or video with other applications or internet. The activity should use `Activity#setShowWhenLocked` to display on top of the lock screen while secured. There is no activity stack when this flag is used, so launching more than one activity is strongly discouraged.

Constant Value: "android.media.action.STILL_IMAGE_CAMERA_SECURE"

### INTENT_ACTION_TEXT_OPEN_FROM_SEARCH

    public static final String INTENT_ACTION_TEXT_OPEN_FROM_SEARCH

An intent to perform a search for readable media and automatically play content from the result when possible. This can be fired, for example, by the result of a voice recognition command to read a book or magazine.

Contains the `SearchManager.QUERY` extra, which is a string that can contain any type of unstructured text search, like the name of a book or magazine, an author a genre, a publisher, or any combination of these.

Because this intent includes an open-ended unstructured search string, it makes the most sense for apps that can support large-scale search of text media, such as services connected to an online database of books and/or magazines which can be read on the device.

Constant Value: "android.media.action.TEXT_OPEN_FROM_SEARCH"

### INTENT_ACTION_VIDEO_CAMERA

    public static final String INTENT_ACTION_VIDEO_CAMERA

The name of the Intent action used to launch a camera in video mode.

Constant Value: "android.media.action.VIDEO_CAMERA"

### INTENT_ACTION_VIDEO_PLAY_FROM_SEARCH

    public static final String INTENT_ACTION_VIDEO_PLAY_FROM_SEARCH

An intent to perform a search for video media and automatically play content from the result when possible. This can be fired, for example, by the result of a voice recognition command to play movies.

Contains the `SearchManager.QUERY` extra, which is a string that can contain any type of unstructured video search, like the name of a movie, one or more actors, a genre, or any combination of these.

Because this intent includes an open-ended unstructured search string, it makes the most sense for apps that can support large-scale search of video, such as services connected to an online database of videos which can be streamed and played on the device.

Constant Value: "android.media.action.VIDEO_PLAY_FROM_SEARCH"

### MATCH_DEFAULT

    public static final int MATCH_DEFAULT

Value indicating that the default matching behavior should be used, as defined by the key documentation.

Constant Value: 0 (0x00000000)

### MATCH_EXCLUDE

    public static final int MATCH_EXCLUDE

Value indicating that operations should exclude items matching the criteria defined by this key.

Constant Value: 2 (0x00000002)

### MATCH_INCLUDE

    public static final int MATCH_INCLUDE

Value indicating that operations should include items matching the criteria defined by this key.

Note that items not matching the criteria may also be included depending on the default behavior documented by the key. If you want to operate exclusively on matching items, use `MATCH_ONLY`.

Constant Value: 1 (0x00000001)

### MATCH_ONLY

    public static final int MATCH_ONLY

Value indicating that operations should only operate on items explicitly matching the criteria defined by this key.

Constant Value: 3 (0x00000003)

### MEDIA_IGNORE_FILENAME

    public static final String MEDIA_IGNORE_FILENAME

Name of the file signaling the media scanner to ignore media in the containing directory and its subdirectories. Developers should use this to avoid application graphics showing up in the Gallery and likewise prevent application sounds and music from showing up in the Music app.

Constant Value: ".nomedia"

### MEDIA_SCANNER_VOLUME

    public static final String MEDIA_SCANNER_VOLUME

Name of current volume being scanned by the media scanner.

Constant Value: "volume"

### META_DATA_REVIEW_GALLERY_PREWARM_SERVICE

    public static final String META_DATA_REVIEW_GALLERY_PREWARM_SERVICE

Name under which an activity handling `ACTION_REVIEW` or `ACTION_REVIEW_SECURE` publishes the service name for its prewarm service.

This meta-data should reference the fully qualified class name of the prewarm service

The prewarm service can be bound before starting `ACTION_REVIEW` or `ACTION_REVIEW_SECURE`. An application implementing this prewarm service should do the absolute minimum amount of work to initialize its resources to efficiently handle an `ACTION_REVIEW` or `ACTION_REVIEW_SECURE` in the near future.

Constant Value: "android.media.review_gallery_prewarm_service"

### META_DATA_STILL_IMAGE_CAMERA_PREWARM_SERVICE

    public static final String META_DATA_STILL_IMAGE_CAMERA_PREWARM_SERVICE

Name under which an activity handling `INTENT_ACTION_STILL_IMAGE_CAMERA` or `INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE` publishes the service name for its prewarm service.

This meta-data should reference the fully qualified class name of the prewarm service extending `CameraPrewarmService`.

The prewarm service will get bound and receive a prewarm signal `CameraPrewarmService#onPrewarm()` when a camera launch intent fire might be imminent. An application implementing a prewarm service should do the absolute minimum amount of work to initialize the camera in order to reduce startup time in likely case that shortly after a camera launch intent would be sent.

Constant Value: "android.media.still_image_camera_preview_service"

### QUERY_ARG_MATCH_FAVORITE

    public static final String QUERY_ARG_MATCH_FAVORITE

Specify how `MediaColumns#IS_FAVORITE` items should be filtered when performing a `MediaStore` operation.

This key can be placed in a `Bundle` of extras and passed to `ContentResolver#query`, `ContentResolver#update`, or `ContentResolver#delete`.

By default, favorite items are not filtered away from operations.
Value is either `0` or a combination of `MATCH_DEFAULT`, `MATCH_INCLUDE`, `MATCH_EXCLUDE`, and `MATCH_ONLY`

See also:

- `MediaStore.MediaColumns.IS_FAVORITE`
- `QUERY_ARG_MATCH_FAVORITE`
- `createFavoriteRequest(ContentResolver, Collection, boolean)`

Constant Value: "android:query-arg-match-favorite"

### QUERY_ARG_MATCH_PENDING

    public static final String QUERY_ARG_MATCH_PENDING

Specify how `MediaColumns#IS_PENDING` items should be filtered when performing a `MediaStore` operation.

This key can be placed in a `Bundle` of extras and passed to `ContentResolver#query`, `ContentResolver#update`, or `ContentResolver#delete`.

By default, pending items are filtered away from operations.
Value is either `0` or a combination of `MATCH_DEFAULT`, `MATCH_INCLUDE`, `MATCH_EXCLUDE`, and `MATCH_ONLY`

Constant Value: "android:query-arg-match-pending"

### QUERY_ARG_MATCH_TRASHED

    public static final String QUERY_ARG_MATCH_TRASHED

Specify how `MediaColumns#IS_TRASHED` items should be filtered when performing a `MediaStore` operation.

This key can be placed in a `Bundle` of extras and passed to `ContentResolver#query`, `ContentResolver#update`, or `ContentResolver#delete`.

By default, trashed items are filtered away from operations.
Value is either `0` or a combination of `MATCH_DEFAULT`, `MATCH_INCLUDE`, `MATCH_EXCLUDE`, and `MATCH_ONLY`

See also:

- `MediaStore.MediaColumns.IS_TRASHED`
- `QUERY_ARG_MATCH_TRASHED`
- `createTrashRequest(ContentResolver, Collection, boolean)`

Constant Value: "android:query-arg-match-trashed"

### QUERY_ARG_RELATED_URI

    public static final String QUERY_ARG_RELATED_URI

Specify a `Uri` that is "related" to the current operation being performed.

This is typically used to allow an operation that may normally be rejected, such as making a copy of a pre-existing image located under a `MediaColumns#RELATIVE_PATH` where new images are not allowed.

It's strongly recommended that when making a copy of pre-existing content that you define the "original document ID" GUID as defined by the XMP Media Management standard.

This key can be placed in a `Bundle` of extras and passed to `ContentResolver#insert`.

Constant Value: "android:query-arg-related-uri"

### UNKNOWN_STRING

    public static final String UNKNOWN_STRING

The string that is used when a media attribute is not known. For example, if an audio file does not have any meta data, the artist and album columns will be set to this value.

Constant Value: ""

### VOLUME_EXTERNAL

    public static final String VOLUME_EXTERNAL

Synthetic volume name that provides a view of all content across the "external" storage of the device.

This synthetic volume provides a merged view of all media across all currently attached external storage devices.

Because this is a synthetic volume, you can't insert new content into this volume. Instead, you can insert content into a specific storage volume obtained from `getExternalVolumeNames(android.content.Context)`.

Constant Value: "external"

### VOLUME_EXTERNAL_PRIMARY

    public static final String VOLUME_EXTERNAL_PRIMARY

Specific volume name that represents the primary external storage device at `Environment#getExternalStorageDirectory()`.

This volume may not always be available, such as when the user has ejected the device. You can find a list of all specific volume names using `getExternalVolumeNames(android.content.Context)`.

Constant Value: "external_primary"

### VOLUME_INTERNAL

    public static final String VOLUME_INTERNAL

Synthetic volume name that provides a view of all content across the "internal" storage of the device.

This synthetic volume provides a merged view of all media distributed with the device, such as built-in ringtones and wallpapers.

Because this is a synthetic volume, you can't insert new content into this volume.

Constant Value: "internal"

## Fields

### AUTHORITY_URI

    public static final Uri AUTHORITY_URI

A content:// style uri to the authority for the media provider

## Public constructors

### MediaStore

    public MediaStore ()

## Public methods

### createDeleteRequest

    public static PendingIntent createDeleteRequest (ContentResolver resolver,
                    Collection<Uri> uris)

Create a `PendingIntent` that will prompt the user to permanently delete the requested media items. When the user approves this request, `ContentResolver#delete` will be called on these items.

This call only generates the request for a prompt; to display the prompt, call `Activity#startIntentSenderForResult` with `PendingIntent#getIntentSender()`. You can then determine if the user granted your request by testing for `Activity#RESULT_OK` in `Activity#onActivityResult`. The requested operation will have completely finished before this activity result is delivered.

The displayed prompt will reflect all the media items you're requesting, including those for which you already hold write access. If you want to determine if you already hold write access before requesting access, use `ContentResolver#checkUriPermission(Uri, int, int)` with `Intent#FLAG_GRANT_WRITE_URI_PERMISSION`.

Parameters
`resolver` | `ContentResolver`: Used to connect with `MediaStore#AUTHORITY`. Typically this value is `Context#getContentResolver()`, but if you need more explicit lifecycle controls, you can obtain a `ContentProviderClient` and wrap it using `ContentResolver#wrap(ContentProviderClient)`. This value cannot be `null`.
`uris` | `Collection`: The set of media items to include in this request. Each item must be hosted by `MediaStore#AUTHORITY` and must reference a specific media item by `BaseColumns#_ID`. This value cannot be `null`.

Returns
`PendingIntent` | This value cannot be `null`.

### createFavoriteRequest

    public static PendingIntent createFavoriteRequest (ContentResolver resolver,
                    Collection<Uri> uris,
                    boolean value)

Create a `PendingIntent` that will prompt the user to favorite the requested media items. When the user approves this request, `MediaColumns#IS_FAVORITE` is set on these items.

This call only generates the request for a prompt; to display the prompt, call `Activity#startIntentSenderForResult` with `PendingIntent#getIntentSender()`. You can then determine if the user granted your request by testing for `Activity#RESULT_OK` in `Activity#onActivityResult`. The requested operation will have completely finished before this activity result is delivered.

The displayed prompt will reflect all the media items you're requesting, including those for which you already hold write access. If you want to determine if you already hold write access before requesting access, use `ContentResolver#checkUriPermission(Uri, int, int)` with `Intent#FLAG_GRANT_WRITE_URI_PERMISSION`.

Parameters
`resolver` | `ContentResolver`: Used to connect with `MediaStore#AUTHORITY`. Typically this value is `Context#getContentResolver()`, but if you need more explicit lifecycle controls, you can obtain a `ContentProviderClient` and wrap it using `ContentResolver#wrap(ContentProviderClient)`. This value cannot be `null`.
`uris` | `Collection`: The set of media items to include in this request. Each item must be hosted by `MediaStore#AUTHORITY` and must reference a specific media item by `BaseColumns#_ID`. This value cannot be `null`.
`value` | `boolean`: The `MediaColumns#IS_FAVORITE` value to apply.

Returns
`PendingIntent` | This value cannot be `null`.

See also:

- `MediaStore.MediaColumns.IS_FAVORITE`
- `QUERY_ARG_MATCH_FAVORITE`

### createTrashRequest

    public static PendingIntent createTrashRequest (ContentResolver resolver,
                    Collection<Uri> uris,
                    boolean value)

Create a `PendingIntent` that will prompt the user to trash the requested media items. When the user approves this request, `MediaColumns#IS_TRASHED` is set on these items.

This call only generates the request for a prompt; to display the prompt, call `Activity#startIntentSenderForResult` with `PendingIntent#getIntentSender()`. You can then determine if the user granted your request by testing for `Activity#RESULT_OK` in `Activity#onActivityResult`. The requested operation will have completely finished before this activity result is delivered.

The displayed prompt will reflect all the media items you're requesting, including those for which you already hold write access. If you want to determine if you already hold write access before requesting access, use `ContentResolver#checkUriPermission(Uri, int, int)` with `Intent#FLAG_GRANT_WRITE_URI_PERMISSION`.

Parameters
`resolver` | `ContentResolver`: Used to connect with `MediaStore#AUTHORITY`. Typically this value is `Context#getContentResolver()`, but if you need more explicit lifecycle controls, you can obtain a `ContentProviderClient` and wrap it using `ContentResolver#wrap(ContentProviderClient)`. This value cannot be `null`.
`uris` | `Collection`: The set of media items to include in this request. Each item must be hosted by `MediaStore#AUTHORITY` and must reference a specific media item by `BaseColumns#_ID`. This value cannot be `null`.
`value` | `boolean`: The `MediaColumns#IS_TRASHED` value to apply.

Returns
`PendingIntent` | This value cannot be `null`.

See also:

- `MediaStore.MediaColumns.IS_TRASHED`
- `QUERY_ARG_MATCH_TRASHED`

### createWriteRequest

    public static PendingIntent createWriteRequest (ContentResolver resolver,
                    Collection<Uri> uris)

Create a `PendingIntent` that will prompt the user to grant your app write access for the requested media items.

This call only generates the request for a prompt; to display the prompt, call `Activity#startIntentSenderForResult` with `PendingIntent#getIntentSender()`. You can then determine if the user granted your request by testing for `Activity#RESULT_OK` in `Activity#onActivityResult`. The requested operation will have completely finished before this activity result is delivered.

Permissions granted through this mechanism are tied to the lifecycle of the `Activity` that requests them. If you need to retain longer-term access for background actions, you can place items into a `ClipData` or `Intent` which can then be passed to `Context#startService` or `JobInfo.Builder.setClipData(ClipData, int)`. Be sure to include any relevant access modes you want to retain, such as `Intent#FLAG_GRANT_WRITE_URI_PERMISSION`.

The displayed prompt will reflect all the media items you're requesting, including those for which you already hold write access. If you want to determine if you already hold write access before requesting access, use `ContentResolver#checkUriPermission(Uri, int, int)` with `Intent#FLAG_GRANT_WRITE_URI_PERMISSION`.

For security and performance reasons this method does not support `Intent#FLAG_GRANT_PERSISTABLE_URI_PERMISSION` or `Intent#FLAG_GRANT_PREFIX_URI_PERMISSION`.

The write access granted through this request is general-purpose, and once obtained you can directly `ContentResolver#update` columns like `MediaColumns#IS_FAVORITE`, `MediaColumns#IS_TRASHED`, or `ContentResolver#delete`.

Parameters
`resolver` | `ContentResolver`: Used to connect with `MediaStore#AUTHORITY`. Typically this value is `Context#getContentResolver()`, but if you need more explicit lifecycle controls, you can obtain a `ContentProviderClient` and wrap it using `ContentResolver#wrap(ContentProviderClient)`. This value cannot be `null`.
`uris` | `Collection`: The set of media items to include in this request. Each item must be hosted by `MediaStore#AUTHORITY` and must reference a specific media item by `BaseColumns#_ID`. This value cannot be `null`.

Returns
`PendingIntent` | This value cannot be `null`.

### getDocumentUri

    public static Uri getDocumentUri (Context context,
                    Uri mediaUri)

Return a `DocumentsProvider` Uri that is an equivalent to the given `MediaStore` Uri.

This allows apps with Storage Access Framework permissions to convert between `MediaStore` and `DocumentsProvider` Uris that refer to the same underlying item. Note that this method doesn't grant any new permissions; callers must already hold permissions obtained with `Intent#ACTION_OPEN_DOCUMENT` or related APIs.

Parameters
`context` | `Context`: This value cannot be `null`.
`mediaUri` | `Uri`: The `MediaStore` Uri to convert. This value cannot be `null`.

Returns
`Uri` | An equivalent `DocumentsProvider` Uri. Returns `null` if no equivalent was found.

See also:

- `getMediaUri(Context, Uri)`

### getExternalVolumeNames

    public static Set<String> getExternalVolumeNames (Context context)

Return list of all specific volume names that make up `VOLUME_EXTERNAL`. This includes a unique volume name for each shared storage device that is currently attached, which typically includes `MediaStore#VOLUME_EXTERNAL_PRIMARY`.

Each specific volume name can be passed to APIs like `MediaStore.Images.Media#getContentUri(String)` to interact with media on that storage device.

Parameters
`context` | `Context`: This value cannot be `null`.

Returns
`Set<String>` | This value cannot be `null`.

### getGeneration

    public static long getGeneration (Context context,
                    String volumeName)

Return the latest generation value for the given volume.

Generation numbers are useful for apps that are attempting to quickly identify exactly which media items have been added or changed since a previous point in time. Generation numbers are monotonically increasing over time, and can be safely arithmetically compared.

Detecting media changes using generation numbers is more robust than using `MediaColumns#DATE_ADDED` or `MediaColumns#DATE_MODIFIED`, since those values may change in unexpected ways when apps use `File#setLastModified(long)` or when the system clock is set incorrectly.

Note that before comparing these detailed generation values, you should first confirm that the overall version hasn't changed by checking `MediaStore#getVersion(Context, String)`, since that indicates when a more radical change has occurred. If the overall version changes, you should assume that generation numbers have been reset and perform a full synchronization pass.

Parameters
`context` | `Context`: This value cannot be `null`.
`volumeName` | `String`: specific volume to obtain an generation value for. Must be one of the values returned from `getExternalVolumeNames(android.content.Context)`. This value cannot be `null`.

Returns
`long` |

See also:

- `MediaStore.MediaColumns.GENERATION_ADDED`
- `MediaStore.MediaColumns.GENERATION_MODIFIED`

### getMediaScannerUri

    public static Uri getMediaScannerUri ()

Uri for querying the state of the media scanner.

Returns
`Uri` |

### getMediaUri

    public static Uri getMediaUri (Context context,
                    Uri documentUri)

Return a `MediaStore` Uri that is an equivalent to the given `DocumentsProvider` Uri.

This allows apps with Storage Access Framework permissions to convert between `MediaStore` and `DocumentsProvider` Uris that refer to the same underlying item. Note that this method doesn't grant any new permissions; callers must already hold permissions obtained with `Intent#ACTION_OPEN_DOCUMENT` or related APIs.

Parameters
`context` | `Context`: This value cannot be `null`.
`documentUri` | `Uri`: The `DocumentsProvider` Uri to convert. This value cannot be `null`.

Returns
`Uri` | An equivalent `MediaStore` Uri. Returns `null` if no equivalent was found.

See also:

- `getDocumentUri(Context, Uri)`

### getRecentExternalVolumeNames

    public static Set<String> getRecentExternalVolumeNames (Context context)

Return list of all recent volume names that have been part of `VOLUME_EXTERNAL`.

These volume names are not currently mounted, but they're likely to reappear in the future, so apps are encouraged to preserve any indexed metadata related to these volumes to optimize user experiences.

Each specific volume name can be passed to APIs like `MediaStore.Images.Media#getContentUri(String)` to interact with media on that storage device.

Parameters
`context` | `Context`: This value cannot be `null`.

Returns
`Set<String>` | This value cannot be `null`.

### getRequireOriginal

    public static boolean getRequireOriginal (Uri uri)

Return if the caller requires the original file contents when calling `ContentResolver#openFileDescriptor(Uri, String)`.

Parameters
`uri` | `Uri`: This value cannot be `null`.

Returns
`boolean` |

See also:

- `setRequireOriginal(Uri)`

### getVersion

    public static String getVersion (Context context,
                    String volumeName)

Return an opaque version string describing the `MediaStore` state.

Applications that import data from `MediaStore` into their own caches can use this to detect that `MediaStore` has undergone substantial changes, and that data should be rescanned.

No other assumptions should be made about the meaning of the version.

Parameters
`context` | `Context`: This value cannot be `null`.
`volumeName` | `String`: specific volume to obtain an opaque version string for. Must be one of the values returned from `getExternalVolumeNames(android.content.Context)`. This value cannot be `null`.

Returns
`String` | This value cannot be `null`.

### getVersion

    public static String getVersion (Context context)

Return an opaque version string describing the `MediaStore` state.

Applications that import data from `MediaStore` into their own caches can use this to detect that `MediaStore` has undergone substantial changes, and that data should be rescanned.

No other assumptions should be made about the meaning of the version.

This method returns the version for `MediaStore#VOLUME_EXTERNAL_PRIMARY`; to obtain a version for a different volume, use `getVersion(android.content.Context, java.lang.String)`.

Parameters
`context` | `Context`: This value cannot be `null`.

Returns
`String` | This value cannot be `null`.

### getVolumeName

    public static String getVolumeName (Uri uri)

Return the volume name that the given `Uri` references.

Parameters
`uri` | `Uri`: This value cannot be `null`.

Returns
`String` | This value cannot be `null`.

### setIncludePending

    public static Uri setIncludePending (Uri uri)

This method is deprecated.
consider migrating to `QUERY_ARG_MATCH_PENDING` which is more expressive.

Update the given `Uri` to also include any pending media items from calls such as `ContentResolver#query(Uri, String[], Bundle, CancellationSignal)`. By default no pending items are returned.

Parameters
`uri` | `Uri`: This value cannot be `null`.

Returns
`Uri` | This value cannot be `null`.

See also:

- `MediaStore.MediaColumns.IS_PENDING`

### setRequireOriginal

    public static Uri setRequireOriginal (Uri uri)

Update the given `Uri` to indicate that the caller requires the original file contents when calling `ContentResolver#openFileDescriptor(Uri, String)`.

This can be useful when the caller wants to ensure they're backing up the exact bytes of the underlying media, without any Exif redaction being performed.

If the original file contents cannot be provided, a `UnsupportedOperationException` will be thrown when the returned `Uri` is used, such as when the caller doesn't hold `Manifest.permission.ACCESS_MEDIA_LOCATION`.

Parameters
`uri` | `Uri`: This value cannot be `null`.

Returns
`Uri` | This value cannot be `null`.

See also:

- `getRequireOriginal(Uri)`

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*