Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: Permission Handler in Android 13 #1119

Closed
3 of 5 tasks
adeliaputrii opened this issue Aug 2, 2023 · 4 comments
Closed
3 of 5 tasks

[Question]: Permission Handler in Android 13 #1119

adeliaputrii opened this issue Aug 2, 2023 · 4 comments
Labels
P2 Important issues not at the top of the work list. platform: android Issue is related to the Android platform. status: closed (missing info) Indicates the issue was automatically closed due to a lack of information. status: needs more info We need more information before we can continue work on this issue. type: question Issue contains a question about the project

Comments

@adeliaputrii
Copy link

Please check the following before submitting a new issue.

Please select for which platform(s) you need help

  • Android
  • iOS
  • Windows

Your question

How to use permission handler in Android 13?
I've already used this code in AndroidManifest.xml and manually enable it in the system settings but it doesn't work :





Version

10.4.3

@shashankantino
Copy link

shashankantino commented Aug 8, 2023

Solution :
IN MENIFEST FILE :
with other read permissions for android 13
IN APP LEVEL BUILD GRADLE :
TargetSdkVersion to 32
compileSdkVersion to 33

@AmenyaZ
Copy link

AmenyaZ commented Aug 8, 2023

After Adding permissions in the Manifest, Use the following during implementation to check the Platform and Android Version. There after call the permission to be used based on the Android version.

Future<bool> _requestWritePermission() async {
   if (Platform.isAndroid) {
     AndroidDeviceInfo androidInfo = await DeviceInfoPlugin().androidInfo;
     int androidVersion = androidInfo.version.sdkInt;
     if (androidVersion < 12) {
       // For Android versions earlier than 12
       await Permission.storage.request();
       return await Permission.storage.isGranted;
     } else {
       // For Android 12 and later
       await Permission.manageExternalStorage.request();
       return await Permission.manageExternalStorage.isGranted;
     }
   }
   return false; // If the platform is not Android
 }

@JeroenWeener
Copy link
Contributor

Hi @adeliaputrii, thank you for reaching out.

Could you provide me with more information on what you are trying to achieve? Are you having troubles requesting a specific permission, such as storage? You could help us help you by supplying a code sample of what you are trying.

@JeroenWeener JeroenWeener added platform: android Issue is related to the Android platform. status: needs more info We need more information before we can continue work on this issue. type: question Issue contains a question about the project P2 Important issues not at the top of the work list. labels Aug 10, 2023
@github-actions
Copy link

Without additional information, we are unfortunately not able to resolve this issue. Therefore, we reluctantly closed this issue for now. If you run into this issue later, feel free to file a new issue with a reference to this issue. Add a description of detailed steps to reproduce, expected and current behaviour, logs and the output of 'flutter doctor -v'. Thanks for your contribution.

@github-actions github-actions bot added the status: closed (missing info) Indicates the issue was automatically closed due to a lack of information. label Aug 24, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Important issues not at the top of the work list. platform: android Issue is related to the Android platform. status: closed (missing info) Indicates the issue was automatically closed due to a lack of information. status: needs more info We need more information before we can continue work on this issue. type: question Issue contains a question about the project
Projects
None yet
Development

No branches or pull requests

4 participants