Description
The application utilizes permission_handler, file_picker, and image_picker to handle document uploads for resident registration (e.g., within document_upload_control.dart).
Currently, the application relies on the standard Permission.storage request. However, on Android 13 (API Level 33) and above, Google has completely deprecated READ_EXTERNAL_STORAGE. If the application requests Permission.storage to access the gallery or file system, the OS will automatically and silently deny it without ever showing a permission prompt to the user.
Because the core registration flow requires capturing and attaching documents, this silent failure means operators using modern Android tablets will be completely blocked from completing registrations.
Steps to Reproduce
- Install the APK on a physical tablet or emulator running Android 13 or 14 (API 33+).
- Navigate to a registration flow that requires document upload.
- Tap the button to select a document from the gallery or storage.
- Observe that no permission dialog appears, the file picker fails to launch, and the action silently fails.
Expected Behavior
The application must detect the Android SDK version at runtime. On Android 13+ devices, it should request the new granular media permissions (READ_MEDIA_IMAGES / READ_MEDIA_VIDEO) instead of the deprecated legacy storage permission.
Environment
- Target Files:
document_upload_control.dart, AndroidManifest.xml
- Impacted Devices: Any device running Android 13 or higher.
Proposed Solution
- Update
android/app/src/main/AndroidManifest.xml to include the granular permissions:
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
- Update the Dart permission logic to conditionally request the correct permission based on the device's OS version:
import 'dart:io';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:permission_handler/permission_handler.dart';
Future<bool> requestStoragePermission() async {
if (Platform.isAndroid) {
final androidInfo = await DeviceInfoPlugin().androidInfo;
if (androidInfo.version.sdkInt >= 33) {
// Use granular permissions for Android 13+
final photosStatus = await Permission.photos.request();
return photosStatus.isGranted;
} else {
// Use legacy storage permission for Android 12 and below
final storageStatus = await Permission.storage.request();
return storageStatus.isGranted;
}
}
return true; // Handle iOS/other platforms accordingly
}
Description
The application utilizes
permission_handler,file_picker, andimage_pickerto handle document uploads for resident registration (e.g., withindocument_upload_control.dart).Currently, the application relies on the standard
Permission.storagerequest. However, on Android 13 (API Level 33) and above, Google has completely deprecatedREAD_EXTERNAL_STORAGE. If the application requestsPermission.storageto access the gallery or file system, the OS will automatically and silently deny it without ever showing a permission prompt to the user.Because the core registration flow requires capturing and attaching documents, this silent failure means operators using modern Android tablets will be completely blocked from completing registrations.
Steps to Reproduce
Expected Behavior
The application must detect the Android SDK version at runtime. On Android 13+ devices, it should request the new granular media permissions (
READ_MEDIA_IMAGES/READ_MEDIA_VIDEO) instead of the deprecated legacy storage permission.Environment
document_upload_control.dart,AndroidManifest.xmlProposed Solution
android/app/src/main/AndroidManifest.xmlto include the granular permissions: