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

permission_handler not working in android13. #1026

Closed
codermonk1 opened this issue Apr 12, 2023 · 18 comments
Closed

permission_handler not working in android13. #1026

codermonk1 opened this issue Apr 12, 2023 · 18 comments
Labels
good first issue Good for newcomers who would like to start contributing to the project. platform: android Issue is related to the Android platform. type: bug Something isn't working

Comments

@codermonk1
Copy link

💬 Questions and Help

in my app permission handler is perfectly work on android 12 and below,
but in Android 13 its not working.

popup message for granting access is not shown.

i have added all user permission in andriod manifest file.

@mayudevID
Copy link

do you want to access storage and files/photos?

@codermonk1
Copy link
Author

codermonk1 commented Apr 14, 2023 via email

@mayudevID
Copy link

Yes, I want access files like pdf

On Fri, Apr 14, 2023, 7:18 PM Maulana Yusuf @.> wrote: do you want to access storage and files/photos? — Reply to this email directly, view it on GitHub <#1026 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARTWHZGVT7OGRLGNPCF2773XBFIT5ANCNFSM6AAAAAAW3MR5OM . You are receiving this because you authored the thread.Message ID: @.>

umm have you tried this type of permissions -> Permission.manageExternalStorage ?

and add this to android manifest
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />

but make sure these permissions have been added before
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

@codermonk1
Copy link
Author

codermonk1 commented Apr 15, 2023 via email

@RobotJohns
Copy link

me too

@AsheKR
Copy link

AsheKR commented Apr 20, 2023

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />

I added the above permissions and solved it with Permission.manageExternalStorage.request() and Permission.manageExternalStorage.isGranted.

@EmirBashiri
Copy link

same issue , any update?

Yes, I did. but not working in android 13 On Fri, Apr 14, 2023 at 7:28 PM Maulana Yusuf @.> wrote:

Yes, I want access files like pdf … <#m_3861515447099737418_> On Fri, Apr 14, 2023, 7:18 PM Maulana Yusuf @.
> wrote: do you want to access storage and files/photos? — Reply to this email directly, view it on GitHub <#1026 (comment) <#1026 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARTWHZGVT7OGRLGNPCF2773XBFIT5ANCNFSM6AAAAAAW3MR5OM https://github.com/notifications/unsubscribe-auth/ARTWHZGVT7OGRLGNPCF2773XBFIT5ANCNFSM6AAAAAAW3MR5OM . You are receiving this because you authored the thread.Message ID: @.
> umm have you tried this type of permissions -> Permission.manageExternalStorage ? and add this to android manifest but make sure these permissions have been added before — Reply to this email directly, view it on GitHub <#1026 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARTWHZFBYOY3YL4KWIVFO7DXBFJYRANCNFSM6AAAAAAW3MR5OM . You are receiving this because you authored the thread.Message ID: @.**>

@Bilonik
Copy link

Bilonik commented Apr 21, 2023

<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />

This permission required to fill a form in android and I got rejected for only needing to upload an image.

@thienphan1996
Copy link

thienphan1996 commented Apr 23, 2023

I am using Permission.storage.request(), on Android 13 return PermissionStatus.permanentlyDenied. Please help me. Thank you.
permission_handler: ^10.2.0

@Nolan1357
Copy link

I got it android 13

// todo
<uses-permission
    android:name="android.permission.READ_EXTERNAL_STORAGE"
    android:maxSdkVersion="29" />// todo

@mmMrz
Copy link

mmMrz commented Apr 27, 2023

I got it android 13

// todo

<uses-permission
    android:name="android.permission.READ_EXTERNAL_STORAGE"
    android:maxSdkVersion="29" />// todo

It's still will be "permanentlyDenied" at Permission.storage.request()

@kkoken
Copy link

kkoken commented May 3, 2023

TLDR: if you try to check or request the WRITE_EXTERNAL_STORAGE on Android 13+, it will always return false. So you'll have to skip the permission check/request completely on Android 13+

source

@orhanweb
Copy link

TLDR: if you try to check or request the WRITE_EXTERNAL_STORAGE on Android 13+, it will always return false. So you'll have to skip the permission check/request completely on Android 13+

source

I was trying to get a picture from the user using the image_picker package, but the storage permission request was returning false without prompting the user on the screen, even though I made the necessary edits in the manifest file. I asked this to GPT and it told me that in android 10 and above, storage permissions are removed and I need to remove these permissions from the manifest file. So we don't need to ask for any permission to get image from user's gallery?

@kkoken
Copy link

kkoken commented May 11, 2023

TLDR: if you try to check or request the WRITE_EXTERNAL_STORAGE on Android 13+, it will always return false. So you'll have to skip the permission check/request completely on Android 13+
source

I was trying to get a picture from the user using the image_picker package, but the storage permission request was returning false without prompting the user on the screen, even though I made the necessary edits in the manifest file. I asked this to GPT and it told me that in android 10 and above, storage permissions are removed and I need to remove these permissions from the manifest file. So we don't need to ask for any permission to get image from user's gallery?

Your case is not related to WRITE_EXTERNAL_STORAGE permission if you are not gonna save a file. If it is, you do not need to ask permission to write a file above Android 13+ (starting from Android 13).

Your case is related to READ_EXTERNAL_STORAGE, and the pickImage method will prompt a message to access the user's gallery.

If you are targeting lower than Android 10, if it is correct targeting, you should not remove the permission from the manifest.

@orhanweb
Copy link

TLDR: if you try to check or request the WRITE_EXTERNAL_STORAGE on Android 13+, it will always return false. So you'll have to skip the permission check/request completely on Android 13+
source

I was trying to get a picture from the user using the image_picker package, but the storage permission request was returning false without prompting the user on the screen, even though I made the necessary edits in the manifest file. I asked this to GPT and it told me that in android 10 and above, storage permissions are removed and I need to remove these permissions from the manifest file. So we don't need to ask for any permission to get image from user's gallery?

Your case is not related to WRITE_EXTERNAL_STORAGE permission if you are not gonna save a file. If it is, you do not need to ask permission to write a file above Android 13+ (starting from Android 13).

Your case is related to READ_EXTERNAL_STORAGE, and the pickImage method will prompt a message to access the user's gallery.

If you are targeting lower than Android 10, if it is correct targeting, you should not remove the permission from the manifest.

With image_picker, I will upload the image I take from the gallery or camera to the cloud instead of saving it to the storage. In other words, I will only select an image from the gallery regarding memory. What should I do in this situation?

@bettkipronoh
Copy link

bettkipronoh commented Jun 23, 2023

Turns out or at least I assume android 13 has the storage allowed. This worked for me .
Checked if API level is 33 then "assumed" it is enabled.

Future<bool> _checkPermission() async {
    if (platform == TargetPlatform.android) {
      var androidInfo = await DeviceInfoPlugin().androidInfo;
      if (androidInfo.version.sdkInt >= 33) return true;
      final status = await Permission.storage.status;
      if (status != PermissionStatus.granted) {
        final result = await Permission.storage.request();
        if (result == PermissionStatus.granted) {
          return true;
        }
      } else {
        return true;
      }
    } else {
      return true;
    }
    return false;
  }

@JeroenWeener
Copy link
Contributor

Possible related issues: #955, #1066

@JeroenWeener JeroenWeener added good first issue Good for newcomers who would like to start contributing to the project. platform: android Issue is related to the Android platform. labels Jun 29, 2023
@JeroenWeener JeroenWeener added the type: bug Something isn't working label Jun 29, 2023
@JeroenWeener
Copy link
Contributor

Thank you @codermonk1 for raising this issue!

This appears to be a duplicate of #955. I am closing this issue. For a solution to your problem, you can have a look at #955. @mvanbeusekom gave an explanation of the issue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers who would like to start contributing to the project. platform: android Issue is related to the Android platform. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests