android_special_permissions: one API for Android's special access screens
Android has two kinds of permissions. The first kind shows a dialog: camera, contacts, location. The second kind has no dialog at all. To read app usage statistics, draw over other apps, schedule exact alarms or get access to all files, the user must open a specific screen in Settings and flip a toggle. Android calls these "special access" permissions. For a Flutter developer this means three…
Android offers two types of permissions: those that trigger a dialog and others that do not. Special access permissions are those that require users to access the Settings screen to grant or deny access. Developers using Flutter need to handle three separate tasks for each special permission: checking if access is granted, finding the correct Settings screen for the Android version, and determining what happens after the user returns. android_special_permissions simplifies this process by managing all special permissions in one API.
It provides status() to check granted or denied status, openSettings() to open the appropriate Settings screen, and request() to wait for user input and return the updated status. The plugin supports 13 special permissions, including usageAccess, overlay, accessibilityService, and more. To use android_special_permissions, add it from GitHub and declare the required permissions in the AndroidManifest.xml for the accesses used by your app.
Access each permission using status(), request(), or roleStatus() as needed. Some special permissions have specific requirements, such as overlay existing from API 23 and exactAlarm from API 31. The plugin handles most Settings screens, but default-app roles require Android 29 or later. Always check Google Play's policy center before releasing your app.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.