Handle permission pop-ups in your Detox tests for Android
Learn how to automatically grant Android app permissions and handle permission pop-ups in your Detox tests on BrowserStack App Automate.
While testing your Android apps, system dialogs and pop-ups can appear that request permissions such as contacts, notifications, or photos. Detox runs inside your app’s process and cannot interact with UI outside that process, so a permission pop-up blocks your test until the session times out.
This feature is available on Android devices only.
Grant all permissions for Android apps
Use the autoGrantPermissions capability to automatically grant your Android app the runtime permissions it declares in its Android manifest. BrowserStack grants these permissions on your device before your test starts, so your test doesn’t hang on a permission pop-up.
The table below lists the capability and its accepted value:
| Capability | Description | Values |
|---|---|---|
autoGrantPermissions |
Grant all manifest-declared permissions for Android apps | true |
Set autoGrantPermissions within the session object of your Detox configuration file:
autoGrantPermissions grants only the runtime permissions your app declares in its Android manifest. Special permissions such as SYSTEM_ALERT_WINDOW and MANAGE_EXTERNAL_STORAGE are not granted, and the capability doesn’t dismiss other system pop-ups.
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!