Baseflow / flutter-permission-handler

Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
https://baseflow.com
MIT License
2.02k stars 840 forks source link

permission_handler not working in android13. #1026

Closed codermonk1 closed 1 year ago

codermonk1 commented 1 year ago

💬 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 commented 1 year ago

do you want to access storage and files/photos?

codermonk1 commented 1 year ago

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 https://github.com/Baseflow/flutter-permission-handler/issues/1026#issuecomment-1508534786, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARTWHZGVT7OGRLGNPCF2773XBFIT5ANCNFSM6AAAAAAW3MR5OM . You are receiving this because you authored the thread.Message ID: @.***>

mayudevID commented 1 year ago

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 commented 1 year ago

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 … <#m3861515447099737418> 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) https://github.com/Baseflow/flutter-permission-handler/issues/1026#issuecomment-1508534786>, 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 <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />

but make sure these permissions have been added before

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

— Reply to this email directly, view it on GitHub https://github.com/Baseflow/flutter-permission-handler/issues/1026#issuecomment-1508566732, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARTWHZFBYOY3YL4KWIVFO7DXBFJYRANCNFSM6AAAAAAW3MR5OM . You are receiving this because you authored the thread.Message ID: @.***>

RobotJohns commented 1 year ago

me too

AsheKR commented 1 year ago

<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 commented 1 year ago

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 … <#m3861515447099737418> 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 commented 1 year ago

<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 commented 1 year ago

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

Nolan1357 commented 1 year ago

I got it android 13

<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
// todo // todo
mmMrz commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Possible related issues: #955, #1066

JeroenWeener commented 1 year ago

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.