Manifest & Permissions

Use Android Photo Picker Instead of Broad Photo Access

Android Photo Picker lets a person select media without granting your app broad access to the entire photo library. For an attachment, avatar or one-off upload feature, this is often a better fit than requesting unrestricted image permissions.

By Updated 2 min read

Choose selection rather than collection access

A picker is appropriate when the user chooses specific items. A full gallery-management application may have different needs, but “upload one image” is not a strong reason to request access to every image on the device.

Follow the Photo Picker documentation for current AndroidX contracts, availability and fallback behavior. Do not hardcode assumptions about which picker UI every device will display.

Handle the result as a URI

This activity or fragment fragment illustrates the single-image flow:

KOTLIN · REFERENCE EXAMPLE
private val chooseImage = registerForActivityResult(
    ActivityResultContracts.PickVisualMedia()
) { uri ->
    if (uri != null) importSelectedImage(uri)
}

// Called after the user chooses “Attach photo”.
chooseImage.launch(
    PickVisualMediaRequest(
        ActivityResultContracts.PickVisualMedia.ImageOnly
    )
)

The helper must validate and stream the content safely. Cancellation returns no selection and should not display an error or start an upload.

Do not turn the URI into a guessed path

Use ContentResolver to open selected content. The provider may serve remote or virtual media. Bound memory use, handle unavailable content and avoid assuming that the filename extension proves the format.

For deferred uploads, follow the documented access-lifetime and persistable-permission rules for the returned URI. Do not assume a temporary grant survives every app or device lifecycle event.

Test real edge cases

Test cancellation, a large image, a remote provider, selected media becoming unavailable and repeated selection. Confirm that the upload does not start before the user chooses the item and that the UI reports progress and failure accurately.

Remove unnecessary broad requests

Review the media access model and the merged release manifest after migration. APKLint's Dangerous Permissions Checker can help identify old storage declarations left behind by the app or SDKs. It cannot verify URI lifetime or image-processing memory behavior; those need runtime tests of the actual import flow.

Sources and further reading

  1. Android Developers: Photo picker
  2. Android Developers: Access media files from shared storage

Reference review: 22 September 2026. Examples illustrate the workflow; check your installed versions, release artifact and account-specific Console requirements before applying them. This guide is not a claim that APKLint executed your project or verified your private account.

APKLint

Android inspection tools and practical release guides. About APKLint · Report a correction