简体   繁体   English

图像选择器权限 Android flutter

[英]Image picker permission Android flutter

In the recent post for data protection page Android/playstore made it clear if you're taking images/videos from a device you need to ask permission.在最近发布的数据保护页面 Android/Playstore 中明确指出,如果您从设备上拍摄图像/视频,则需要征得许可。

Declares at least one of the following permissions: READ_EXTERNAL_STORAGE WRITE_EXTERNAL_STORAGE至少声明以下权限之一: READ_EXTERNAL_STORAGE WRITE_EXTERNAL_STORAGE

Now flutter imagepicker is现在颤振图像选择器

No configuration required - the plugin should work out of the box.无需配置 - 插件应该开箱即用。

And if I am asking permission explicitly app is not responding to the permission means not invoking what should I do.如果我明确请求许可,应用程序没有响应许可意味着不调用我应该做什么。 Flutter image-picker explicitly ask permission I am only picking images. Flutter 图像选择器明确征求许可我只选择图像。 Then uploading it to firebase.然后将其上传到firebase。

From the documentation - image_picker has been updated to make use of scoped storage .从文档中 - image_picker has been updated to make use of scoped storage

In other words, you do not have to ask for permissions on devices running Android 10>.换句话说,您不必在运行 Android 10> 的设备上请求权限。 With Scoped Storage, you are granted permissions.使用范围存储,您被授予权限。

In your application, you can check if the device is running SDK 28< and ask permission if it is.在您的应用程序中,您可以检查设备是否正在运行 SDK 28< 并请求许可。

Have a look at the answers in this question.看看这个问题的答案。

On devices that run Android 4.4 (API level 19) and higher, your app can interact with a documents provider , including external storage volumes and cloud-based storage, using the Storage Access Framework.在运行 Android 4.4(API 级别 19)及更高版本的设备上,您的应用程序可以使用存储访问框架与文档提供程序交互,包括外部存储卷和基于云的存储。 This framework allows users to interact with a system picker to choose a documents provider and select specific documents and other files for your app to open.该框架允许用户与系统选择器交互以选择文档提供者并选择特定文档和其他文件供您的应用程序打开。

Because the user is involved in selecting the files or directories that your app can access, this mechanism doesn't require any system permissions[READ,WRITE Permission] , and user control and privacy is enhanced.由于用户参与选择您的应用可以访问的文件或目录,因此该机制不需要任何系统权限[READ,WRITE Permission] ,并且增强了用户控制和隐私。 Additionally, these files, which are stored outside of an app-specific directory and outside of the media store, remain on the device after your app is uninstalled.此外,这些文件存储在特定于应用程序的目录之外和媒体商店之外,在您的应用程序卸载后仍保留在设备上。

Note: If your app uses the media store, however, you must request the READ_EXTERNAL_STORAGE permission to access other apps' media files.注意:但是,如果您的应用程序使用媒体商店,则您必须请求 READ_EXTERNAL_STORAGE 权限才能访问其他应用程序的媒体文件。


In the above case ( image picker ), uses ACTION_GET_CONTENT to open an file , which opens a system document picker using SAF framework and doesn't need permission.在上面的例子中(图像选择器),使用ACTION_GET_CONTENT打开一个文件,它使用 SAF 框架打开一个系统文档选择器,不需要权限。

Talkin about Data protection - When opening file using ACTION_GET_CONTENT - Because the user is involved in selecting the files or directories that your app can access.谈论数据保护- 使用ACTION_GET_CONTENT打开文件时 - 因为用户参与选择您的应用程序可以访问的文件或目录。 App has only access to a URI of image selected by the user, and there is no way to automate the image selection process, so user image is not altered in any way possible, and remain on the device after your app is uninstalled.应用程序只能访问用户选择的图像的 URI,并且无法自动执行图像选择过程,因此用户图像不会以任何可能的方式进行更改,并在您的应用程序卸载后保留在设备上。

Image picker copies the result URI from document picker into a temp cache of your app, from where the image is uploaded to a firebase(or any other place you need a image) - See this answer to see how it picks the image - Flutter image picker .图像选择器将结果 URI 从文档选择器复制到您的应用程序的临时缓存中,从那里将图像上传到 Firebase(或您需要图像的任何其他位置)-请参阅此答案以了解它如何选择图像-Flutter 图像选择器

Since this a official way provided by google - explained here , app should not cause any security threat to the user privacy由于这是谷歌提供的官方方式 - 在此处解释,应用程序不应对用户隐私造成任何安全威胁。

Further if you want(I hardly feel that needed), you can show a permission declaration dialog , stating that app is going to navigate to a file picker and saves a temp copy in app cache, not altering the original image in any way(or something similar you fells right).此外,如果您愿意(我几乎觉得不需要),您可以显示一个权限声明对话框,说明该应用程序将导航到文件选择器并将临时副本保存在应用程序缓存中,而不以任何方式更改原始图像(或类似的东西你说对了)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM