-
-
Notifications
You must be signed in to change notification settings - Fork 912
Add support for granular media permissions on Android 13 #870
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
Conversation
# Conflicts: # permission_handler/CHANGELOG.md # permission_handler_android/CHANGELOG.md
|
any timeline when these changes might be released? |
|
Android 13 started to rollout, we still have no ability to use these READ_MEDIA_IMAGES, READ_MEDIA_VIDEO and READ_MEDIA_AUDIO |
|
Any plans to release this? Android 13 is already out |
|
This PR needs to be approved and merged by a maintainer in order to be released, so I don't have any idea when these changes will be released. |
|
Until this get merged you can use compileSdk 32 and targetSdk 32 and it will work just fine. I hope this gets merged soon so we could use API 33, but it is what it is for now. |
|
Hi! Thanks. |
|
Android 13 introduces the granular permissions. Android 12 and lower does not have that and everything should work the same as is used to. |
Yes, but now do we have to check if Android < 12 keep asking for storage permission and if Android > 12 ask for media or pictures permissions? Or just ask for a granular one on Android 13 and it should fallback to storage permission if it's a lower android version? |
|
I tried using only I see this on my terminal (using I still needed to use existing
Android is not my field expertise, deprecated methods everywhere after every release. More & more permissions with each SDK. Still, It would've been cooler if Android engineers could handle it automatically. i.e. showing full-media access dialog on Android 12 or lower. |
|
Anyone knows how can I use this branch in my app? |
This is what I will test now. I created a method channel that returns me the SDK Int, and will add new logic only if Android > 12 |
|
Tried like this: But I am getting this error with pub get: |
Yes, it does work on Android < 13 but you still need to set targetSdkVersion 33. Also I'd recommend you to use device_info_plus to check if Android SDK version is 33 or higher and then ask this permissions. |
@armandojimenez this happens because I have increased the version number for the packages in this PR. But I can publish these changes into a new package on pub.dev if you want to use these features. |
Please do! I had to fork your branch, then edit the interface package version number to 3.7.0 so it does not throw errors, and then I had to do overrides like this: I just tested this and everything is working! But I had to create a method channel that returns the SDK int and do a condition to ask for Permission.photo when > Android12, and Permission.storage when < Android12. It would be good if the logic in the package verified the SDK version, and fallback to Permission.storage, so we don't need to handle that logic on the dart side |
|
|
|
With this pull I was able to release my app with SDK 33. Since this was closed, any plans to implement this permissions? |
|
@felipheallef why was this closed? |
|
@Zazo032 @armandojimenez It appears because PR #934 supersedes it. |
✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)
Feature: Added support for the new Android 13 granular media permissions: READ_MEDIA_IMAGES, READ_MEDIA_VIDEO and READ_MEDIA_AUDIO.
Apps should ask for READ_EXTERNAL_STORAGE to read data from the external storage.
🆕 What is the new behavior (if this is a feature change)?
Apps targeting Android 13 must request one or more new permissions instead of the READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions.
If the user previously granted your app the READ_EXTERNAL_STORAGE permission, the system automatically grants each of the new permissions to the app.
💥 Does this PR introduce a breaking change?
No, everything should work as expected.
🐛 Recommendations for testing
Run the example project at permission_handler/example using an emulator or physical device running Android 13.
📝 Links to relevant issues/docs
🤔 Checklist before submitting
master.