[expo-media-library] get/request permission always returns undetermined / denied
See original GitHub issueSummary
MediaLibrary.getPermissionsAsync() always returns status:undetermined when granted(denied when denied), and when canAskAgain:true, requestPermissionsAsync() always returns granted:false immediately without asking.
Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!
bare
What platform(s) does this occur on?
Android
SDK Version (managed workflow only)
43.0.3
Environment
Expo CLI 4.13.0 environment info: System: OS: macOS 11.6 Shell: 5.8 - /bin/zsh Binaries: Node: 12.19.0 - /usr/local/bin/node Yarn: 2.4.2 - /usr/local/bin/yarn npm: 8.1.3 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0 IDEs: Android Studio: 4.1 AI-201.8743.12.41.6858069 Xcode: 13.0/13A233 - /usr/bin/xcodebuild npmPackages: expo: ^43.0.3 => 43.0.3 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 react-native: 0.64.3 => 0.64.3 react-native-web: 0.17.1 => 0.17.1 npmGlobalPackages: expo-cli: 4.13.0 Expo Workflow: bare
Reproducible demo or steps to reproduce from a blank project
install bare workflow project, add dependencies expo 43.0.3, expo-media-library
let permission = await MediaLibrary.getPermissionsAsync(); if (!permission.granted) { if (permission.canAskAgain || permission.status === “undetermined”) { permission = await MediaLibrary.requestPermissionsAsync(false); if (!permission.granted) { //denied return; } } else { //denied return; } }
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:37 (6 by maintainers)
Top Related StackOverflow Question
@emmbyiringiro thanks for your comment. But it doesn’t work as we want, unfortunately. EVEN THOUGH access is allowed in android settings, the return value for the function getPermissionAsync is
{granted:false, canAskAgain:false, status:"undetermined"}when I expect as follows :
{granted:true, canAskAgain:false, status:"granted"}Same issue. my project ejected. Add
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />to src/main/AndroidManifest.xml, then it behaved as expected