Open alexlozdev opened 10 months ago
+1
same
Thank you for pointing this out, we have labelled the issue as a bug and added it to our backlog.
same, I need this android 14 feature working well please don't abandon it
same
Instead of saying "I have the same", which really doesn't help resolving the issue, try to provide more information about the bug.
An example app reproducing the behavior for example would be of great help.
Instead of saying "I have the same", which really doesn't help resolving the issue, try to provide more information about the bug.
An example app reproducing the behavior for example would be of great help.
Upon testing the application on my Samsung M15 device running Android 14, I encountered a "permission denied" error. However, the same application functions correctly on BrowserStack's simulated Samsung phone with Android 14 😕
Instead of saying "I have the same", which really doesn't help resolving the issue, try to provide more information about the bug.
An example app reproducing the behavior for example would be of great help.
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: PermissionExample(),
);
}
}
class PermissionExample extends StatefulWidget {
const PermissionExample({super.key});
@override
_PermissionExampleState createState() => _PermissionExampleState();
}
class _PermissionExampleState extends State<PermissionExample> {
PermissionStatus? _permissionStatus;
@override
void initState() {
super.initState();
_checkPermissionStatus();
}
Future<void> _checkPermissionStatus() async {
final androidInfo = await DeviceInfoPlugin().androidInfo;
PermissionStatus status;
if (androidInfo.version.sdkInt <= 32) {
status = await Permission.storage.request();
} else {
status = await Permission.photos.request();
}
setState(() {
_permissionStatus = status;
});
}
Future<void> _requestPermission() async {
PermissionStatus
status; // Declared the status variable outside the try-catch block
try {
status = await Permission.photos.request();
} catch (e) {
status =
PermissionStatus.denied; // Handled the exception in case of an error
}
setState(() {
_permissionStatus = status;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Photo Permission Example'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'Photo Permission Status: ${_permissionStatus ?? "Unknown"}',
style: const TextStyle(fontSize: 18),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: _requestPermission,
child: const Text('Request Permission'),
),
],
),
),
);
}
}
<!-- Permission to read files from external storage (outside application container).
As of Android 12 this permission no longer has any effect. Instead use the
READ_MEDIA_IMAGES, READ_MEDIA_VIDEO or READM_MEDIA_AUDIO permissions. -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
<!-- Permissions to read media files. -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED" />
permission_handler: ^11.3.1
device_info_plus: ^10.1.0
Please try with this code. It is showing always permission denied. There is no implementation of this feature https://developer.android.com/about/versions/14/changes/partial-photo-video-access
I manage to fix the behavior by this package https://pub.dev/packages/photo_manager
@AnujLM it is still not working. Could you please provide an example of how it works.
This issue should be resolved with the latest update of the permission_handler_android
package (which the permission_handler
depends on).
@pranavo72bex, @QL-Uday, can you verify if you application is using version 12.0.8 of the permission_handler_android
package? To verify the version used by the application open the pubspec.lock
file and find the entry for permission_handler_android
package.
If the application is not on version 12.0.8, run flutter pub upgrade permission_handler_android
to update to the latest version and test again.
In my application, I am using the following versions: permission_handler: 11.3.1 permission_handler_android: 12.0.8 permission_handler_platform_interface: 4.2.2
These are the latest available. But still it is not working, giving "PermissionStatus.denied", upon clicking limited access. I am request the Permission.photos .
Hey,
I had the same issue and I'm using the same versions as @QL-Uday. After I completely uninstalled and reinstalled my app - as well as running flutter clean && flutter pub get
-> it worked. Thanks @mvanbeusekom.
Maybe @QL-Uday can you try to also uninstall and reinstall to see if it helps?
@novas1r1 , I was already doing that too. But for a confirmation, I again performed these step, still unsuccessful.
I am currently working with compileSdk 34 and targetSdk 34. In my AndroidManifest.xml file, I have included the following permissions:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED" />
@novas1r1 , @mvanbeusekom , Could you please advise if there are any additional permissions or configurations required to ensure that "Limited access" functionality works as expected?
Thank you for your assistance.
For the issue I encountered, by removing the "READ_MEDIA_VISUAL_USER_SELECTED" permission from my app's AndroidManifest.xml file resolved the problem. It appears that this permission was causing conflicts with another permission added by the permission_handler
library in the same manifest file.
Thank you for your assistance in this matter.
There is a workaround. Permission.photos.request()
is returning PermissionStatus.denied
, but Permission.photos.isLimited
returns true
.
So you can call
Permission.photos.request()
and do not check answer of this call but than check if user granted permissions using this code
await Permission.photos.isGranted || await Permission.photos.isLimited
I tried above solution and most recent version, but both isGranted
and isLimited
would return false
.
Console is telling me D/permissions_handler(25261): No permissions found in manifest for: []9
.
In my understanding, the Permission READ_MEDIA_IMAGES
is no longer required and it should still work.
Playstore requires a special reason when I want to use this Permission and it doesn't work for me so far without it 🤔
Please check the following before submitting a new issue.
Please select affected platform(s)
Steps to reproduce
AndroidManifest.xml
When selecting 'Selected Photos Access enabled', it always return PermissionStatus.permanentelyDenied
Expected results
PermissionStatus.granted
Actual results
PermissionStatus.permanentelyDenied
Code sample
Code sample
```dart late PermissionStatus newPermReq; final deviceInfo = DeviceInfoPlugin(); if (Platform.isAndroid) { final androidInfo = await deviceInfo.androidInfo; final androidSdkInt = androidInfo.version.sdkInt ?? 0; if (androidSdkInt < 33) { newPermReq = await Permission.storage.request(); } else { newPermReq = await Permission.photos.request(); } } else if (Platform.isIOS) { newPermReq = await Permission.photos.request(); } ```Screenshots or video
Screenshots or video demonstration
[Upload media here]Version
11.1.0
Flutter Doctor output
Doctor output
```console ![01](https://github.com/Baseflow/flutter-permission-handler/assets/61686168/7135a115-6342-4710-bbc1-2199b7a7554a) ```