T E C H N I X I O
Technixio Assistant Ask about our services
Hi! I'm Technixio's assistant. Ask me about our services, careers, or how to get in touch.

PhotoPickerCompat

PhotoPickerCompat
Open Source
PhotoPickerCompat
Open-source Kotlin Android library wrapping the modern Photo Picker API with an automatic, permission-free fallback for older Android versions.

Overview

PhotoPickerCompat is a small open-source Kotlin library for Android. It wraps the modern Photo Picker and falls back automatically, with no permissions, on devices where the picker isn't available. Apps get photo selection with no READ_MEDIA_IMAGES and no READ_EXTERNAL_STORAGE permission, on any Android version.

Why It Exists

We hit this exact problem while shipping #HashKit. Google Play rejected the app for asking for broad photo permissions for a feature that only needed one user-picked photo. Google's answer is the Photo Picker, but most sample code ignores what happens on the many active devices that don't have it. PhotoPickerCompat answers the "else" case.

How It Works

  • Picker available (native on Android 13+, or backported to Android 11–12 through a Google Play system update): the real Photo Picker opens
  • Picker not available: it falls back to ACTION_OPEN_DOCUMENT, which is just as permission-free and scoped-storage-safe
  • Same result either way. Both paths return a plain content:// Uri, or a list of Uris for multi-select, so app code never needs to know which path ran.

What Developers Get

  • PhotoPicker for a single image and MultiPhotoPicker for several images or videos
  • No boilerplate: no manifest entries, no registerForActivityResult wiring and no permission checks
  • Easy install through JitPack
  • A sample app with zero permissions in its manifest that exercises both pickers end to end

Engineering Highlights

  • Tested on both paths. Robolectric unit tests pin specific API levels (28 for the fallback, 33 for the real picker), so both branches are tested deterministically.

Tech Stack

Kotlin, AndroidX Activity Result APIs, Robolectric and JitPack.

Status

Open source under the MIT licence at github.com/mukeshkumar356/PhotoPickerCompat.

Kotlin Android Library Open Source
Discuss a Similar Project

Project Details

CategoryOpen Source
Tech StackKotlin, Android Library, Open Source
Source CodeVisit →
Built ByTechnixio