如何将 expo-image-picker 与 android 11 范围存储一起使用?
how to use expo-image-picker with android 11 scoped storage?
我在我的 expo 管理的 React 本机应用程序中使用了 expo-image-picker。它工作正常。
我只需要使用相机拍摄新照片并从图库中为我的应用挑选照片。
对于这些,我使用了以下 API
ImagePicker.requestMediaLibraryPermissionsAsync()
ImagePicker.requestCameraPermissionsAsync()
ImagePicker.launchImageLibraryAsync()
ImagePicker.launchCameraAsync()
对于 android,我在 app.json 文件中的权限数组如下
"permissions": [
"CAMERA",
"CAMERA_ROLL",
"READ_EXTERNAL_STORAGE",
"WRITE_EXTERNAL_STORAGE",
"LOCATION"
]
现在google给我发了这封邮件
We've detected that your app contains the requestLegacyExternalStorage
flag in the manifest file of 1 or more of your app bundles or APKs.
Developers with apps on devices running Android 11+ must use Scoped
Storage to give users better access control over their device storage.
To release your app on Android 11 or newer after May 5th, you must
either:
Update your app to use more privacy friendly best practices, such as
the Storage Access Framework or Media Store API Update your app to
declare the All files access (MANAGE_EXTERNAL_STORAGE) permission in
the manifest file, and complete the All files access permission
declaration in Play Console from May 5th Remove the All files access
permission from your app entirely For apps targeting Android 11, the
requestLegacyExternalStorage flag will be ignored. You must use the
All files access permission to retain broad access.
Apps requesting access to the All files access permission without a
permitted use will be removed from Google Play, and you won't be able
to publish updates.
谁能帮我解决这个问题?
我需要更改图像选择器 api 中的任何内容吗?或者我是否需要从我的权限数组中添加/删除某些内容?
请帮助我...请...
得到解决方案。
实际上我的代码没有问题。是google把我搞糊涂了。
这是详细信息 https://github.com/expo/expo/issues/12603#issuecomment-827600227
我在我的 expo 管理的 React 本机应用程序中使用了 expo-image-picker。它工作正常。 我只需要使用相机拍摄新照片并从图库中为我的应用挑选照片。 对于这些,我使用了以下 API
ImagePicker.requestMediaLibraryPermissionsAsync()
ImagePicker.requestCameraPermissionsAsync()
ImagePicker.launchImageLibraryAsync()
ImagePicker.launchCameraAsync()
对于 android,我在 app.json 文件中的权限数组如下
"permissions": [
"CAMERA",
"CAMERA_ROLL",
"READ_EXTERNAL_STORAGE",
"WRITE_EXTERNAL_STORAGE",
"LOCATION"
]
现在google给我发了这封邮件
We've detected that your app contains the requestLegacyExternalStorage flag in the manifest file of 1 or more of your app bundles or APKs.
Developers with apps on devices running Android 11+ must use Scoped Storage to give users better access control over their device storage. To release your app on Android 11 or newer after May 5th, you must either:
Update your app to use more privacy friendly best practices, such as the Storage Access Framework or Media Store API Update your app to declare the All files access (MANAGE_EXTERNAL_STORAGE) permission in the manifest file, and complete the All files access permission declaration in Play Console from May 5th Remove the All files access permission from your app entirely For apps targeting Android 11, the requestLegacyExternalStorage flag will be ignored. You must use the All files access permission to retain broad access.
Apps requesting access to the All files access permission without a permitted use will be removed from Google Play, and you won't be able to publish updates.
谁能帮我解决这个问题? 我需要更改图像选择器 api 中的任何内容吗?或者我是否需要从我的权限数组中添加/删除某些内容? 请帮助我...请...
得到解决方案。 实际上我的代码没有问题。是google把我搞糊涂了。 这是详细信息 https://github.com/expo/expo/issues/12603#issuecomment-827600227