Runtime Permissions Testing: Test Cases for Android and iPhone
How to test every permission state on real phones, from the first ask to deny twice, Only this time, approximate location, selected photos and a revoke in Settings.
In this article
- What runtime permissions testing covers
- How the prompt behaves on Android and iPhone
- The deny-twice trap on Android
- Only this time, and coming back later
- Revoking a permission in Settings mid-task
- Location: approximate, precise and background
- Photos: when the user shares only three
- Notifications are a permission too
- iPhone: one prompt, then Settings
- A runtime permissions testing matrix for one release
- How to write a permission test case
- Frequently asked questions
A field agent in Nagpur opens a lending app on a Redmi 13C to photograph a customer's PAN card. The camera prompt appears while she is mid-sentence with the customer, and she taps Don't allow. She taps the camera button again, the prompt comes back, and she taps Don't allow a second time out of habit.
The third tap does nothing. No prompt, no message, only an empty frame where the camera preview should be. The app is asking Android for the camera, Android is answering "denied" without showing a dialog, and the app has no screen for that answer.
Nothing crashed, so there is no crash report. On the team's own test phones the camera was allowed in the first week of the project, and nobody has seen the denied state since. Runtime permissions testing closes that gap. It checks what the app does in every permission state a real user can reach, not only the one where everyone tapped Allow.
What runtime permissions testing covers
A runtime permission is one the user grants while the app is running, through a system dialog, instead of at install time. Camera, microphone, location, photos, contacts and notifications all work this way on current phones. On Android, dangerous permissions are requested at runtime from Android 6.0 onwards. On an iPhone, the system asks the first time the app touches a protected resource.
Testing them means walking each permission through its states and checking the app at every stop. There are more states than most test plans list.
| State | How a user gets there | What the app should do |
|---|---|---|
| Not asked yet | Fresh install | Ask only when the feature is used |
| Allowed | Taps Allow or While using the app | Carry on with the task |
| Denied once | Taps Don't allow one time | Explain why, then offer to ask again |
| Denied for good | Denies twice on Android, once on iPhone | Stop asking and show a route to Settings |
| Allowed once | Taps Only this time or Allow Once | Work now, ask again on the next visit |
| Limited | Approximate location or selected photos | Work with less and say what is missing |
| Revoked later | Switches it off in Settings | Recover without a crash or a lost form |
That is seven states. A plan that only runs the second row has covered one state in seven.
OTP auto-fill is left out here on purpose. It behaves differently from a permission prompt and is covered in why OTP autofill works in testing but fails for real users.
How the prompt behaves on Android and iPhone
The two platforms agree on the idea and differ on details that matter to a tester.
| Behaviour | Android | iPhone |
|---|---|---|
| When the prompt shows | When the app requests the permission | The first time the app uses the resource |
| How often it can show | Until the user denies twice (Android 11 and later) | Once |
| After the final denial | The request is refused with no dialog | Every later attempt fails with no prompt |
| Who writes the text | The system; the app cannot edit it | A system title plus the app's purpose string |
| One-time grant | Only this time: location, microphone, camera | Allow Once: location |
| Where the user changes it | System settings | Settings |
The iPhone column comes from Apple's guide to requesting access to protected resources.
Two things follow. On both platforms there is a state where the app asks and nothing visible happens, so the app has to detect that state and draw its own screen. And since the system dialog is outside the team's control, the wording you can test is on the screens the app shows before and after it: the explanation before the request and the "permission is off" message after a denial. Read those screens in each language the app ships, since they are app text that someone has to translate.
Practical rule: every feature behind a permission needs three designed screens: the explanation, the denied message and the route to Settings. If the design file has only the happy path, raise it before testing starts.
The deny-twice trap on Android
From Android 11, a user who taps Deny (labelled Don't allow on newer versions) more than once for the same permission is treated as having chosen "don't ask again". After that, the app's request is answered without a dialog, and Android's own permission guide describes the second denial as permanent. Older versions kept showing the dialog unless the user ticked a "don't ask again" option. The count belongs to the installation, so a fresh install starts from zero.
Here is the lending app from the opening, written as a case. The phone is the Redmi 13C, the build is a fresh install, and the user is logged in.
| Step | Action | Expected result |
|---|---|---|
| 1 | On the PAN step, tap Take photo | One line on why the camera is needed, then the system prompt |
| 2 | Tap Don't allow | App stays on the PAN step and offers Try again |
| 3 | Tap Try again, then Don't allow | App says the camera is now switched off for it |
| 4 | Tap Take photo a third time | No system prompt; app shows Open Settings and Upload from gallery |
| 5 | Open Settings, allow Camera, return | PAN step is still there and the camera opens |
Step 4 is where the opening story broke. A blank preview or a dead button at this point is a functional bug, not a user mistake, and on a KYC step it stops the whole loan application. The same pattern applies to every camera-led step in Aadhaar eKYC testing.
When a developer needs to confirm what a tester saw, Android exposes the state. adb shell dumpsys package PACKAGE_NAME lists the permission with a USER_SET flag after one denial and USER_FIXED after the second. To rerun the case without reinstalling:
adb shell pm clear-permission-flags PACKAGE_NAME PERMISSION_NAME user-set user-fixed
Only this time, and coming back later
Android 11 also added Only this time for location, microphone and camera. The grant holds while the app's screen is visible. After the user leaves, the app can keep access for a short period, or for as long as a foreground service it started keeps running. Then the permission is gone, and the next use prompts again.
A tester who always picks While using the app never sees this path. Take a video KYC call on a Galaxy A15: the user grants camera and microphone with Only this time, then switches to Messages to read an OTP.
- Return after 10 seconds. The call should still have picture and sound.
- Return after 10 minutes. Either the call is alive, or the app says the session ended and asks again. A frozen frame under a "Connected" label is a bug.
- Close the app, reopen it the next morning and start a new call. The prompt appears again, and the app treats it as a normal first ask, not an error.
Add "choose Only this time" as an explicit step in at least one case for each of the three permissions that offer it.
Revoking a permission in Settings mid-task
Users change their minds, and both platforms let them do it at any moment. On Android the effect is abrupt: when a user revokes a permission in system settings, the app's process is terminated. The user who taps back into the app is not resuming. The app is starting again, possibly in the middle of a form.
Test it with real data in flight. On a Realme Narzo 60, fill four of the six fields on a grocery app's address form, including Use my current location. Open the app's permission page in Settings, set Location to Don't allow, and come back through recent apps. A good result has three parts: the app opens without a crash loop, the four fields are restored or the app says plainly that the form was reset, and the location field shows "location is off" instead of a stale address.
Android has an automatic version of this. If an app targets Android 11 or higher and is not used for a few months, the system resets its runtime permissions. The returning user has old data on the phone and no permissions. You cannot wait months inside a test cycle, but revoking in Settings on an account with saved data gives you the same combination.
On an iPhone, Apple's advice to developers is to check the authorisation status every time before using a feature, because the user can change it in Settings whenever they like. The test has the same shape: switch Camera off for the app, return, tap the feature, and expect the app's own "camera is off" screen.
Location: approximate, precise and background
Location has the most combinations, because accuracy, duration and background use are separate choices. From Android 12, a user can pick approximate location even when the app asks for precise, and Android's location permission guide tells apps to request both levels together.
| User's choice on Android 12 or later | What the app receives | What to check |
|---|---|---|
| Precise, While using the app | Fine and coarse location | Pin lands on the right building |
| Precise, Only this time | Fine and coarse, this visit only | Next visit asks again cleanly |
| Approximate, While using the app | Coarse location only | App asks the user to confirm the pin |
| Approximate, Only this time | Coarse only, this visit only | Both of the checks above |
| Don't allow | No location | Manual address entry works end to end |
Picture a rider at a gate on 100 Feet Road in Indiranagar, Bengaluru, who chooses Approximate in a cab app. With coarse location the app cannot know which side of the road the rider is on. The correct behaviour is to say the location is approximate and ask the rider to set the pickup point. Auto-confirming a pickup from a coarse fix is the bug. If the app then asks for precise access, Android shows a different dialog with a Change to precise location option, so run both answers. A user who later drops from precise to approximate also causes the app's process to restart.
Background location is a separate request. Android expects the app to get foreground access first and ask for background access later. If an app targeting Android 11 or higher asks for both in one request, the system ignores it and grants neither. To a tester this looks like an Enable live tracking button that does nothing, which matters for delivery partner and field staff apps.
One caution on diagnosis. Tracking that works with the screen on and stops after the phone locks may be a battery restriction from the manufacturer's skin and not a permission fault. That has its own checklist: Android background restrictions on HyperOS, ColorOS and One UI.
Photos: when the user shares only three
Android 14 added a middle option to the photo prompt for apps that target it: Select photos and videos. The app can then read only the items the user picked, as Android's page on partial access to photos and videos explains. The iPhone photo prompt has a similar Select Photos choice.
Take a KYC upload where a user with hundreds of photos selects three: Aadhaar front, Aadhaar back and PAN.
- The app's gallery shows exactly three items, with no broken thumbnails and no error about the rest.
- The user photographs a cancelled cheque and returns. The new photo is not visible until the user reselects, so the app needs a visible way to add more.
- Access to selected items expires eventually. On a later visit the app must cope with an empty result and ask again instead of showing a blank grid.
- An app that has not adopted the new permission gets a temporary grant for the session, which ends when the app goes to the background. Select photos, switch away to copy an IFSC code, return, and check that the upload still completes or asks again cleanly.
Before writing cases, find out how the app picks images. Android recommends the system photo picker, which needs no storage permission at all. If the app uses it, most of these cases reduce to "the picker opens and returns the photo".
Notifications are a permission too
Since Android 13, an app needs a runtime permission to post notifications. On a fresh install notifications are off until the user allows them. On a phone that upgraded from Android 12 or lower, eligible apps that were already installed keep the permission without a prompt. Swiping the prompt away is neither answer, and the state does not change.
So two phones on the same Android version can behave differently depending on install history. Run the fresh install case at minimum, and if a payment confirmation or delivery alert never arrives, check the permission state before blaming the server. The full set of checks is in how to test push notifications.
iPhone: one prompt, then Settings
An iPhone gives the app one prompt per resource. If the user taps Don't Allow, the system remembers, and the app cannot bring the prompt back. Four checks are specific to iOS.
- The purpose string. The sentence under the alert title is written by the developer. Read each one: it should say specifically why the app needs the access. Apple also tells developers to translate it for every language the app supports, so set the iPhone to Hindi and look again.
- A missing purpose string. Without one, access fails and the app may crash. An SDK added late can introduce this, so open every permission-gated feature once on the release build.
- After a denial. Tap the feature again. The app should show its own screen with a route to Settings, not a blank view.
- Resetting. Apple's documented way to see the prompts again is Reset Location & Privacy, which resets these settings for every app on the phone. Use a test iPhone, not a personal one.
The rest of an iOS pass is covered in iOS mobile testing.
A runtime permissions testing matrix for one release
Put the permissions down the side and the states across the top, and mark what applies.
| Permission | First ask | Deny once | Deny for good | One-time | Limited | Revoked |
|---|---|---|---|---|---|---|
| Camera | Yes | Yes | Yes | Yes | No | Yes |
| Microphone | Yes | Yes | Yes | Yes | No | Yes |
| Location | Yes | Yes | Yes | Yes | Approximate | Yes |
| Photos | Yes | Yes | Yes | No | Selected | Yes |
| Notifications | Yes | Yes | Yes | No | No | Yes |
That is 25 checks for an Android build that uses all five. An iPhone pass is shorter, because the first denial is already final.
Version matters because each recent release changed one row: Android 11 brought deny-twice and Only this time, Android 12 approximate location, Android 13 the notification prompt and Android 14 selected photos. The free 99tests runtime permissions test cases, 37 in all, ask for fresh installs on Android 11 or lower, 12, 13 and 14 or later, plus an iPhone, and for a Xiaomi, Vivo or Oppo phone and a Samsung phone, including a budget model with 3 to 4 GB of RAM. The list also has a dual-SIM phone with two active SIMs and, where the app pairs with an accessory, a Bluetooth device. Run all 25 on the newest Android version, then the version-specific rows on the others. If you are unsure which models to choose, start from the phones your users carry.
Practical rule: permission cases start from a fresh install. A phone that answered the prompts weeks ago can only test the Revoked column.
How to write a permission test case
Permission cases get rejected in review when the starting state is missing. Every case needs four facts: the permission state at the start, the install history, the OS version and the exact option tapped.
- ID and title: RP-07, camera denied twice on Scan QR
- Precondition: fresh install on Android 13, logged in, camera never requested
- Steps: tap Scan QR, tap Don't allow, tap Scan QR, tap Don't allow, tap Scan QR
- Expected: no system prompt on the third tap; the app shows "Camera is off for this app", an Open Settings button and an Enter UPI ID option
- Must not happen: a blank scanner, a frozen screen or the app closing
The layout follows the usual format for test cases. Note that the expected result names an alternative route. For a UPI payment, typing the UPI ID is the fallback when scanning is unavailable, and that fallback is part of the case.
The same four facts belong in the bug report. "Camera not working" cannot be reproduced. "Camera denied twice on a fresh install, Android 13, Redmi 13C, third tap on Scan QR shows a blank screen" can, and it follows the pattern in steps to reproduce a bug.
Frequently asked questions
What is runtime permissions testing? It is checking how an app behaves in each state of a permission the user grants while the app is running: not asked yet, allowed, denied once, denied for good, allowed once, limited and revoked later.
How do I see the permission prompt again? On Android, uninstall and reinstall, since the denial count belongs to the installation, or have a developer clear the flags with adb. On an iPhone, use Reset Location & Privacy on a test device, because it resets every app.
Can an emulator cover these cases? Partly. An emulator shows the standard Android dialogs, which is enough for the basic states. It does not show how the flow behaves on the Redmi, Vivo and Galaxy builds your users carry. The split is explained in emulator vs real device testing.
Should an app ask for every permission at first launch? No. Android's guidance is to wait until the user starts the feature that needs the permission, and Apple's design guidance says much the same unless the app cannot work without it. A wall of prompts at launch invites denials, and on Android two denials are final.
Is this the same as security testing? No. Permission testing is functional: it checks behaviour in each state, including things a user would notice, such as an app asking for contacts it never uses. It is not a penetration test or VAPT, and 99tests does not offer those.
How many test cases does one permission flow need? The 99tests library lists 37 for runtime permissions: 7 happy path, 7 validation and negative, 6 edge cases, 5 interruptions and network, 6 device and OS, 4 security and privacy and 2 accessibility and language.
Permission bugs live in states your own phone left behind weeks ago, which is why they surface on other people's devices. 99tests runs your test cases on tester-owned phones, including Redmi, Realme, Galaxy, Vivo and iPhone on Jio, Airtel and Vi, and a reviewer verifies every finding before it reaches you. Each finding carries steps, expected and actual results, environment details and a screenshot or recording. Start with the free library of 950 test cases across 25 flows, or see how a run works at 99tests.