skip to content

As the lead of an Android social app, what permission policy do you set, and when do you replace a runtime permission with a permissionless system API?

level: principalimportance: should knowfreq 40%

answer

  1. every prompt can be refused
  2. pickers before permissions
  3. dependencies bring permissions too
  4. give back what you stopped using

basics

~20 s

Declare the fewest permissions each feature needs: the photo picker instead of media access, the system camera intent instead of CAMERA, coarse over precise location. Ask in context, degrade on denial, review what SDKs add and give back unused grants.

solid answer

~50 s

My default is that every runtime permission must justify itself against a permissionless alternative. Attaching existing photos goes through the photo picker, which needs no runtime permission and grants temporary read access to the chosen URIs. Taking a photo with the system camera uses `ACTION_IMAGE_CAPTURE` without declaring `CAMERA`; only an in-app camera with live filters earns `CAMERA`. Location defaults to coarse, and on Android 17 (API 37) a session-only location button or the contacts picker can replace a prompt entirely. Every remaining permission is asked in context, with a degraded path that still lets people post. Because SDKs bring permissions too, the merged manifest is diffed in CI per release. When an update stops using a permission, `revokeSelfPermissionsOnKill()` (API 33) gives it back. The trade-off I own is UX control versus prompts and trust: a custom gallery is nicer, but costs a permission many users refuse.

go deeper

for a junior

Recall that many features need no permission at all: the photo picker and the system camera intent are the usual examples.

for a middle

Explain which permissionless APIs replace which permissions, and the catch with declaring CAMERA while using ACTION_IMAGE_CAPTURE.

for a senior

Show how you enforce the policy: a merged-manifest diff in CI, degraded paths tested for every permission, and self-revocation after a migration.

for a principal

Own the trade-off between product control and user trust, write the policy as a reviewed list of permissions with their rejected alternatives, and revisit it each platform release.

## The decision a lead owns On Android every runtime permission is a prompt the user can refuse, and refusing twice ends the prompt for that install. Each declared permission is also something the team must justify to users and, for sensitive ones, to the store. So the lead's question is not "how do we request this?" but **"do we need to ask at all?"**, and that answer becomes a policy the team applies to every feature. There is no single right policy; the trade-off is product control against user trust and friction. ## Prefer a system API that needs no permission Android's guidance on minimising permissions lists alternatives that cover many social-app features: | Feature | Permission-heavy route | Permissionless or narrower route | |---|---|---| | Attach existing photos or videos | Broad media access | **Photo picker**: no runtime permission; temporary read access to the selected URIs | | Take a photo with the system camera | `CAMERA` | **`ACTION_IMAGE_CAPTURE`** intent, without declaring `CAMERA` | | Record a video | `CAMERA` | **`ACTION_VIDEO_CAPTURE`** intent | | Pick a contact to invite | `READ_CONTACTS` | **`ACTION_PICK_CONTACTS`** (Android 17 / API 37): session-based access to specific fields | | "Posts near me right now" | `ACCESS_FINE_LOCATION` | **System location button** (API 37): precise location for the session, no dialog | | Nearby feed | `ACCESS_FINE_LOCATION` | `ACCESS_COARSE_LOCATION` | | Read a document the user made elsewhere | Storage permissions | Storage Access Framework | One trap belongs in the policy itself: if the manifest **declares `CAMERA`** and the user hasn't granted it, launching `ACTION_IMAGE_CAPTURE` results in a `SecurityException`. Declaring a permission "just in case" can break the permissionless path. ## Where a permission is still right Some features genuinely need the permission: - An in-app camera with live filters or AR effects needs `CAMERA`; handing off to the system camera app can't apply them. - Continuous location sharing with friends may need background location, which Google Play restricts to core functionality. - SMS and call-log permissions, for an app published on Google Play, require prompting the user to make the app the default handler for that function before requesting them. The policy should name these exceptions and who signs off on new ones. ## Rules for the permissions that remain 1. **Ask in context**, when the user starts the feature, never in a launch-time batch. 2. **Explain** in the app's own UI before the request when the rationale check says so; the system dialog can't be customised. 3. **Degrade gracefully**: a denied camera still leaves text posts and the photo picker. 4. **Don't nag**: no full-screen blocks, no repeated pushes to settings. 5. **Check before every use**, since grants are revoked, expire ("Only this time") or are auto-reset when an app targeting Android 11 (API 30) or higher goes unused for months. ## Dependencies are part of the policy When you include a library, you inherit its permission requirements, and from the user's point of view the request comes from your app. So: - Review the merged manifest per release and fail CI on any new permission. - Choose SDKs that don't demand permissions they don't need; an analytics or ads library asking for precise location is a cost to weigh, not a given. ## Giving permissions back On Android 13 (API 33) and higher, `revokeSelfPermissionOnKill()` and `revokeSelfPermissionsOnKill()` let the app give up runtime permissions it no longer uses, for example after moving photo attachments to the photo picker. The removal is asynchronous and happens when the system kills the app's processes, usually after a while in the background. For settings to show that the app no longer accesses a group, revoke every permission in that group, and tell users on the next launch. ## The trade-offs to argue - **UX control vs. friction**: a custom gallery or in-app camera can look better, but costs a prompt that some users refuse, and a refusal is sticky. - **Precision vs. trust**: precise location improves "nearby" ranking a little and costs a prompt and policy scrutiny. - **Maintenance**: every permission adds a granted, denied and permanently denied path to build and test. - **Platform drift**: new releases add pickers and narrower grants (the contacts picker and location button in API 37), so the policy is revisited each platform release. A defensible policy reads as a short list: the permissions the app may declare, the feature each serves, the permissionless alternative that was rejected and why, and the release in which it is next reviewed.

  • Why can declaring CAMERA break a feature that only launches the system camera?
    Launching `ACTION_IMAGE_CAPTURE` needs no permission when the app does not declare `CAMERA`. But if the manifest declares `CAMERA` and the user hasn't granted it, the launch results in a `SecurityException`. So an app that only uses the system camera should not declare the permission at all, and the policy should catch declarations added just in case.
  • How do you stop holding a permission an older version of the app needed?
    On Android 13 (API 33) and higher, call `revokeSelfPermissionsOnKill()` in the update with the runtime permissions the app no longer requires, ideally every permission in the group so settings stop listing it. The removal is asynchronous and takes effect when the system kills the app's processes, usually after the app has spent a while in the background. A dialog on the next launch tells users what changed.

It is like handing a visitor a single key for one room instead of the master key: the picker gives the app the one photo the user chose, while a broad permission hands over the whole house and invites the owner to say no.

  • Requesting broad media access is required before the photo picker can return images.
  • Declaring CAMERA as a precaution is harmless if the app only uses ACTION_IMAGE_CAPTURE.
  • Permissions that SDKs add to the manifest are the SDK vendor's concern, not the app's.
  • Once granted, a permission stays with the app until the user uninstalls it.

Assumes Android 17 (API 37), which adds the contacts picker and the location button; self-revocation exists since Android 13 (API 33) and auto-reset applies to apps targeting Android 11 (API 30) or higher.