CaptureMediaContract
Activity result contract for capturing a photo or a video with a camera app.
The caller lists the camera apps available for the Mode with targets, lets the user pick one when there are several, and launches the contract with the picked Target. Capture intents are launched directly rather than through Intent.createChooser: the Android 16 share sheet crashes the system process when a target without a MIME type is picked.
Files are created in external storage directories:
Photos:
{externalFilesDir}/Pictures/Videos:
{externalFilesDir}/Movies/With fallback to cache directories if external storage is unavailable.
After createIntent the caller should persist pictureFile and videoFile paths so they can be restored after process death via the constructor.
Parameters
The capture mode determining what media types can be captured.
Manager for creating temporary files in external storage.
Previously created photo file to restore after process death.
Previously created video file to restore after process death.
Provider of the content URI the camera app writes the capture to.
Constructors
Types
Properties
The photo destination file created by createIntent, or restored via constructor.
The video destination file created by createIntent, or restored via constructor.