Handle permission pop-ups in your Flutter Integration tests for Android

While testing different scenarios, it is common for Android apps to present various pop-ups or system dialogs that request users to grant different permissions (e.g., contacts, notifications, photos, etc.) to the application.

Grant all permissions for Android apps

While testing your Android apps, use the Flutter’s autoGrantPermissions parameter to automatically determine which permissions your app requires and grant them to the app on install. These permissions are determined based on the Android manifest defined in the app’s .APK file.

To grant all permissions, set autoGrantPermissions to true when running a build using the builds REST API.

Example cURL request to enable autoGrantPermissions:

```bash curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \ -X POST "https://api-cloud.browserstack.com/app-automate/flutter-integration-tests/v2/android/build" \ -d '{ "autoGrantPermissions": "true", "devices": ["Samsung Galaxy S9 Plus-9.0"], "app":"bs://69672c289c49d6a03623870b0704c336c6ea9118", "testSuite": "bs://94757b23f5318d9ce496b24c2d958f64cfe917e2"}' \ -H "Content-Type: application/json" ```

Did this page help you?

Yes No

We're sorry to hear that. Please share your feedback so we can do better

Submit

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


Any additional feedback?

Submit

Thank you for your valuable feedback

Is this page helping you?

Yes No

We're sorry to hear that. Please share your feedback so we can do better

Submit Skip

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


Any additional feedback?

Submit Skip

Thank you for your valuable feedback!

ncG1vNJzZmivp6x7o77OsKqeqqOprqS3jZympmeUpLC0e8Cpp2aZpam8rq3TnmafpKWpwaa%2BjqCcrayZo7Ruv9Oaqa2dlGSupcLAp5qenF2bsqLA1KucrGeYlruluMRmp56qnZ7AtLXOp2Spp6BiwrG%2F