Reference

Content Provider Internals

A content provider is an Android component that exposes a structured, permission-controlled data set through content:// URIs, letting one app query, insert, update, or delete another app's data via a ContentResolver. MediaStore is the system provider for photos, videos, and audio.

Build & packagingAndroid

Content Provider Internals

Also known as: content provider android, provider uri, android content provider

A content provider is an Android component that exposes a structured, permission-controlled data set through content:// URIs, letting one app query, insert, update, or delete another app's data via a ContentResolver. MediaStore is the system provider for photos, videos, and audio.

  • Clients reach a provider through a ContentResolver, never directly, via content:// URIs.
  • MediaStore is the system content provider for shared photos, videos, and audio.
  • Under scoped storage, MediaStore returns content URIs instead of raw file paths.

How a content provider works

A content provider abstracts a data store behind a stable `content://` URI namespace. Clients never touch the provider directly; they call a ContentResolver, which routes `query()`, `insert()`, `update()`, and `delete()` calls across process boundaries to the provider via Binder IPC. The provider returns a Cursor for reads — a row/column result set the client iterates over.

Each URI typically encodes an authority (which provider) and a path (which data set or row). Permissions are enforced at the provider boundary, and short-lived URI grants let an app temporarily share a single item without exposing its whole store.

MediaStore as the provider for media

For photos, videos, and audio, the relevant provider is the MediaStore. A cleanup app queries collections such as `MediaStore.Images.Media.EXTERNAL_CONTENT_URI`, projecting columns like `_ID`, `DISPLAY_NAME`, `SIZE`, `DATE_TAKEN`, and `DATA`, then opens each item through the resolver.

Under scoped storage (Android 10+), the MediaStore is the sanctioned path to shared media — apps get content URIs rather than raw file paths, and access is bounded by the granted READ_MEDIA_* permissions. This indirection is also why two different content URIs can point at copies of the same underlying image, which a scanner must reconcile.

Why scanners depend on it

A storage cleaner enumerates the device's media almost entirely through the MediaStore content provider: it pulls a cursor of every image and video, reads size and date metadata cheaply, then opens pixels only when it needs to compute a perceptual hash for duplicate or similar-photo detection. Building Cleanor's scan on the provider keeps it fast, scoped, and compliant — it sees exactly what the user authorized and nothing more.

Related terms

Keep reading the reference.

Act on it

Guides and tools for this topic.