breautek commented on issue #866:
URL: 
https://github.com/apache/cordova-plugin-camera/issues/866#issuecomment-1810252762

   > > Currently the ultimate reason for the READ_MEDIA permissions is because 
camera returns external storage file:// URLs
   > 
   > Aren't media access permissions also needed when using 
`Camera.PictureSourceType.PHOTOLIBRARY` and 
`Camera.PictureSourceType.SAVEDPHOTOALBUM`? I think Android Photo Picker 
applies to those cases.
   
   I think I was inaccurate on my detail earlier... It seems like the camera 
plugin when capturing an image from the camera hardware, the native side will 
use the content uri and copy the image to internal storage partition, and the 
file URI returned is a path to internal storage. In this case, the READ_MEDIA 
permission isn't necessary.
   
   However I believe you're right, if the image is sourced from the photo 
album, it returns the external storage file uri to that resource which does 
require READ_MEDIA permission.
   
   It does appear that the file plugin has some support with content uri paths 
via 
[ContentFilesystem](https://github.com/apache/cordova-plugin-file/blob/master/src/android/ContentFilesystem.java).
 I'm thinking the best path forward is to see if that class actually works as 
expected and to maybe start experimenting with `content://` paths being 
returned to the webview. I'm not sure if there are any drawbacks other than 
access to content urls isn't persistent, so it will unsafe to store as the 
read/write permission to that content is temporary. It will have to be up to 
the user to decide how to handle that case, such as storing a cache copy of the 
resource, if they need long-term access to it. (e.g. setting an user's profile 
pic.)
   
   In general, if working with content urls more closely does work, it will 
probably make the file plugin a bit more powerful since content urls can 
represent data not necessary on the user's disk, but from a remote source (e.g. 
Google Drive).
   
   > `onType.DATA_URL`, then `READ_MEDIA` permissions are not necessary. Is it 
right?
   
   READ_MEDIA permissions is necessary when trying to use the Filesystem API 
(via file plugin) or the native `java.io.File` classes. Choosing `DATA_URL` may 
allow you to avoid using the File plugin, but it really depends on what the 
native side is doing to read the content, so I'm not sure if it will completely 
allow you to avoid requiring the permission.
   
   On the other note, `DATA_URL` is harsh on memory consumption, so it really 
should be avoided at all costs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to