Skip to content

Commit 7a0244d

Browse files
Updates documentation for Permission.photos on Android (#1195)
* updates documentation for Permission.photos on Android * added style change * update * minor update
1 parent d6a4a36 commit 7a0244d

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

permission_handler_platform_interface/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 4.0.1
2+
3+
* Updates Android documentation on how to use `permission.photo` on Android 12 (API 32) and below and Android 13 (API 33) and above.
4+
15
## 4.0.0
26

37
* **BREAKING CHANGE**: Replaces `Permission.calendarReadOnly` with `Permission.calendarWriteOnly`.

permission_handler_platform_interface/lib/src/permissions.dart

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,27 @@ class Permission {
9494
/// Depending on the platform and version, the requirements are slightly
9595
/// different:
9696
///
97-
/// **Android:**
98-
/// - When running on Android 13 (API 33) and above: Read image files from
99-
/// external storage
100-
/// - When running below Android 13 (API 33): Nothing
101-
///
10297
/// **iOS:**
10398
/// - When running Photos (iOS 14+ read & write access level)
99+
///
100+
/// **Android:**
101+
/// - Devices running Android 12 (API level 32) or lower: use [Permissions.storage].
102+
/// - Devices running Android 13 (API level 33) and above: Should use [Permissions.photos].
103+
///
104+
/// EXAMPLE: in Manifest:
105+
/// <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
106+
/// <uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
107+
///
108+
/// In Flutter to check the status:
109+
///
110+
/// if (Platform.isAndroid) {
111+
/// final androidInfo = await DeviceInfoPlugin().androidInfo;
112+
/// if (androidInfo.version.sdkInt <= 32) {
113+
/// use [Permissions.storage.status]
114+
/// } else {
115+
/// use [Permissions.photos.status]
116+
/// }
117+
/// }
104118
static const photos = Permission._(9);
105119

106120
/// Permission for adding photos to the device's photo library (iOS only).

permission_handler_platform_interface/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: A common platform interface for the permission_handler plugin.
33
homepage: https://github.com/baseflow/flutter-permission-handler/tree/master/permission_handler_platform_interface
44
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
55
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
6-
version: 4.0.0
6+
version: 4.0.1
77

88
dependencies:
99
flutter:

0 commit comments

Comments
 (0)