You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On most operating systems, permissions aren't just granted to apps at install time.
4
-
Rather, developers have to ask the user for permissions while the app is running.
4
+
Rather, developers have to ask the user for permission while the app is running.
5
5
6
6
This plugin provides a cross-platform (iOS, Android) API to request permissions and check their status.
7
-
You can also open the device's app settings so users can grant a permission.
8
-
On Android, you can show a rationale for requesting a permission.
7
+
You can also open the device's app settings so users can grant permission.
8
+
On Android, you can show a rationale for requesting permission.
9
9
10
10
See the [FAQ](#faq) section for more information on common questions when using the permission_handler plugin.
11
11
@@ -16,13 +16,13 @@ While the permissions are being requested during runtime, you'll still need to t
16
16
<details>
17
17
<summary>Android</summary>
18
18
19
-
**Upgrade pre1.12 Android projects**
19
+
**Upgrade pre-1.12 Android projects**
20
20
21
-
Since version 4.4.0 this plugin is implemented using the Flutter 1.12 Android plugin APIs. Unfortunately this means App developers also need to migrate their Apps to support the new Android infrastructure. You can do so by following the [Upgrading pre 1.12 Android projects](https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects) migration guide. Failing to do so might result in unexpected behaviour. Most common known error is the permission_handler not returning after calling the `.request()` method on a permission.
21
+
Since version 4.4.0 this plugin is implemented using the Flutter 1.12 Android plugin APIs. Unfortunately, this means App developers also need to migrate their Apps to support the new Android infrastructure. You can do so by following the [Upgrading pre 1.12 Android projects](https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects) migration guide. Failing to do so might result in unexpected behavior. The most common known error is the permission_handler not returning after calling the `.request()` method on permission.
22
22
23
23
**AndroidX**
24
24
25
-
As of version 3.1.0 the <kbd>permission_handler</kbd> plugin switched to the AndroidX version of the Android Support Libraries. This means you need to make sure your Android project is also upgraded to support AndroidX. Detailed instructions can be found [here](https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility).
25
+
As of version 3.1.0, the <kbd>permission_handler</kbd> plugin switched to the AndroidX version of the Android Support Libraries. This means you need to make sure your Android project is also upgraded to support AndroidX. Detailed instructions can be found [here](https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility).
26
26
27
27
The TL;DR version is:
28
28
@@ -45,7 +45,7 @@ android {
45
45
3. Make sure you replace all the `android.` dependencies to their AndroidX counterparts (a full list can be found [here](https://developer.android.com/jetpack/androidx/migrate)).
46
46
47
47
Add permissions to your `AndroidManifest.xml` file.
48
-
There's a`debug`, `main` and `profile`version which are chosen depending on how you start your app.
48
+
There are`debug`, `main`, and `profile`versions which are chosen depending on how you start your app.
49
49
In general, it's sufficient to add permission only to the `main` version.
50
50
[Here](https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler/example/android/app/src/main/AndroidManifest.xml)'s an example `AndroidManifest.xml` with a complete list of all possible permissions.
51
51
@@ -57,82 +57,82 @@ In general, it's sufficient to add permission only to the `main` version.
57
57
Add permission to your `Info.plist` file.
58
58
[Here](https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler/example/ios/Runner/Info.plist)'s an example `Info.plist` with a complete list of all possible permissions.
59
59
60
-
> IMPORTANT: ~~You will have to include all permission options when you want to submit your App.~~ This is because the `permission_handler` plugin touches all different SDKs and because the static code analyser (run by Apple upon App submission) detects this and will assert if it cannot find a matching permission option in the `Info.plist`. More information about this can be found [here](https://github.com/Baseflow/flutter-permission-handler/issues/26).
60
+
> IMPORTANT: ~~You will have to include all permission options when you want to submit your App.~~ This is because the `permission_handler` plugin touches all different SDKs and because the static code analyzer (run by Apple upon App submission) detects this and will assert if it cannot find a matching permission option in the `Info.plist`. More information about this can be found [here](https://github.com/Baseflow/flutter-permission-handler/issues/26).
61
61
62
62
The <kbd>permission_handler</kbd> plugin use [macros](https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler_apple/ios/Classes/PermissionHandlerEnums.h) to control whether a permission is enabled.
63
63
64
-
You must list permission you want to use in your application:
64
+
You must list the permission you want to use in your application:
65
65
66
66
1. Add the following to your `Podfile` file:
67
67
68
68
```ruby
69
69
post_install do |installer|
70
70
installer.pods_project.targets.each do |target|
71
71
... # Here are some configurations automatically generated by flutter
72
-
72
+
73
73
# Start of the permission_handler configuration
74
74
target.build_configurations.each do |config|
75
-
75
+
76
76
# You can enable the permissions needed here. For example to enable camera
77
77
# permission, just remove the `#` character in front so it looks like this:
78
78
#
79
79
# ## dart: PermissionGroup.camera
80
80
# 'PERMISSION_CAMERA=1'
81
81
#
82
-
# Preprocessor definitions can be found in: https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler_apple/ios/Classes/PermissionHandlerEnums.h
82
+
# Preprocessor definitions can be found at: https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler_apple/ios/Classes/PermissionHandlerEnums.h
2. Remove the `#` character in front of the permission you do want to use. For example if you need access to the calendar make sure the code looks like this:
135
+
2. Remove the `#` character in front of the permission you want to use. For example, if you need access to the calendar make sure the code looks like this:
136
136
137
137
```ruby
138
138
## dart: PermissionGroup.calendar
@@ -157,8 +157,9 @@ You must list permission you want to use in your application:
Some permissions will not show a dialog asking the user to allow or deny the requested permission.
226
252
This is because the OS setting(s) of the app are being retrieved for the corresponding permission.
227
-
The status of the setting will determine whether the permission is `granted` or `denied`.
253
+
The status of the setting will determine whether the permission is `granted` or `denied`.
228
254
229
-
The following permissions will show no dialog:
255
+
The following permissions will show no dialog:
230
256
231
257
- Notification
232
258
- Bluetooth
233
259
234
-
The following permissions will show no dialog, but will open the corresponding setting intent for the user to change the permission status:
260
+
The following permissions will show no dialog, but will open the corresponding setting intent for the user to change the permission status:
235
261
236
262
- manageExternalStorage
237
263
- systemAlertWindow
@@ -246,23 +272,23 @@ This will then bring up another permission popup asking you to `Keep Only While
246
272
247
273
### Requesting "storage" permissions always returns "denied" on Android 13+. What can I do?
248
274
249
-
On Android the `Permission.storage` permission is linked to the Android `READ_EXTERNAL_STORAGE` and `WRITE_EXTERNAL_STORAGE` permissions. Starting from Android 10 (API 29) the `READ_EXTERNAL_STORAGE` and `WRITE_EXTERNAL_STORAGE` permissions have been marked deprecated and have been fully removed/disabled since Android 13 (API 33).
275
+
On Android, the `Permission.storage` permission is linked to the Android `READ_EXTERNAL_STORAGE` and `WRITE_EXTERNAL_STORAGE` permissions. Starting from Android 10 (API 29) the `READ_EXTERNAL_STORAGE` and `WRITE_EXTERNAL_STORAGE` permissions have been marked deprecated and have been fully removed/disabled since Android 13 (API 33).
250
276
251
-
If your application needs access to media files Google recommends using the `READ_MEDIA_IMAGES`, `READ_MEDIA_VIDEOS` or `READ_MEDIA_AUDIO` permissions instead. These can be requested using the `Permission.photos`, `Permission.videos` and `Permission.audio` respectively. To request these permissions make sure the `compileSdkVersion` in the `android/app/build.gradle` file is set to `33`.
277
+
If your application needs access to media files Google recommends using the `READ_MEDIA_IMAGES`, `READ_MEDIA_VIDEOS`, or `READ_MEDIA_AUDIO` permissions instead. These can be requested using the `Permission.photos`, `Permission.videos`, and `Permission.audio` respectively. To request these permissions make sure the `compileSdkVersion` in the `android/app/build.gradle` file is set to `33`.
252
278
253
279
If your application needs access to Android's file system, it is possible to request the `MANAGE_EXTERNAL_STORAGE` permission (using `Permission.manageExternalStorage`). As of Android 11 (API 30), the `MANAGE_EXTERNAL_STORAGE` permission is considered a high-risk or sensitive permission. Therefore it is required to [declare the use of these permissions](https://support.google.com/googleplay/android-developer/answer/9214102) if you intend to release the application via the Google Play Store.
254
280
255
281
### Requesting `Permission.locationAlways` always returns "denied" on Android 10+ (API 29+). What can I do?
256
282
257
-
Starting with Android 10, apps are required to first obtain the permission to read the device's location in the foreground, before requesting to read the location in the background as well. When requesting for the 'location always' permission directly, or when requesting both permissions at the same time, the system will ignore the request. So, instead of calling only `Permission.location.request()`, make sure to first call either `Permission.location.request()` or `Permission.locationWhenInUse.request()`, and obtain permission to read the GPS. Once you obtain this permission, you can call `Permission.locationAlways.request()`. This will present the user with the option to update the settings so the location can always be read in the background. For more information, visit the [Android documentation on requesting location permissions](https://developer.android.com/training/location/permissions#request-only-foreground).
283
+
Starting with Android 10, apps are required to first obtain permission to read the device's location in the foreground, before requesting to read the location in the background as well. When requesting the 'location always' permission directly, or when requesting both permissions at the same time, the system will ignore the request. So, instead of calling only `Permission.location.request()`, make sure to first call either `Permission.location.request()` or `Permission.locationWhenInUse.request()`, and obtain permission to read the GPS. Once you obtain this permission, you can call `Permission.locationAlways.request()`. This will present the user with the option to update the settings so the location can always be read in the background. For more information, visit the [Android documentation on requesting location permissions](https://developer.android.com/training/location/permissions#request-only-foreground).
258
284
259
285
## Issues
260
286
261
-
Please file any issues, bugs or feature request as an issue on our [GitHub](https://github.com/Baseflow/flutter-permission-handler/issues) page. Commercial support is available if you need help with integration with your app or services. You can contact us at [hello@baseflow.com](mailto:hello@baseflow.com).
287
+
Please file any issues, bugs, or feature requests as an issue on our [GitHub](https://github.com/Baseflow/flutter-permission-handler/issues) page. Commercial support is available if you need help with integration with your app or services. You can contact us at [hello@baseflow.com](mailto:hello@baseflow.com).
262
288
263
289
## Want to contribute
264
290
265
-
If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our [contribution guide](../CONTRIBUTING.md) and send us your [pull request](https://github.com/Baseflow/flutter-permission-handler/pulls).
291
+
If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug, or adding a cool new feature), please carefully review our [contribution guide](../CONTRIBUTING.md) and send us your [pull request](https://github.com/Baseflow/flutter-permission-handler/pulls).
0 commit comments