You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/09/23 18:51:37 UTC

[GitHub] [cordova-plugin-file] necrodamus opened a new issue #496: Cannot read or delete files under cordova.file.externalRootDirectory for Android 10

necrodamus opened a new issue #496:
URL: https://github.com/apache/cordova-plugin-file/issues/496


   # Bug Report
   i Cannot read files under cordova.file.externalRootDirectory for Android 11
   
   ## Problem
   I can not read or delete files in android 10
   cordova.file.externalRootDirectory
   'file:///storage/emulated/0/'
   ### What is expected to happen?
   delete file 
   ### What does actually happen?
   Type error 5
   
   ![image](https://user-images.githubusercontent.com/26715966/134566274-27574588-7251-4548-bbb8-c82e3d682bed.png)
   
   
   ## Information
   <!-- Include all relevant information that might help understand and reproduce the problem -->
   window.resolveLocalFileSystemURL(
       "file:///storage/emulated/0/Pictures/IMG_20210923_112519.jpeg",
       function(fileEntry) {
         console.log("ENTRY URL " + fileEntry.toURL());
         console.log("IS FILE: " + fileEntry.isFile);
         fileEntry.remove(function (file) {
           
           console.log("file removed!");
       }, function (error) {
           
           console.log("error occurred: " + error.code);
       }, function () {
            $parameters.log = "file does not exist";
           console.log("file does not exist");
       });
   
         fileEntry.file(function(file){
           console.log("FILE: " + file.name);
           console.log("SIZE: " + file.size);
           console.log("TYPE: " + file.type);
     
           var reader = new FileReader();
           reader.onloadend = function() {
             console.log("READER END");
             console.log(this.result);
           };
           reader.onerror = function(er) {
             console.log("READER ERROR");
             console.log(er);
           };
     
           reader.readAsDataURL(file);
         }, console.error);
       },
       console.error
     );
   
   
   
   
   
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   
   window.resolveLocalFileSystemURL("file:///storage/emulated/0/Pictures/IMG_20210923_112519.jpeg", function(f) {
       f.filesystem.root.remove(function(){console.log('ok root')}, function(error){console.log(error)})
     });
   
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   I try with this , the same  isue in delete
   {
       "plugin": {
           "url": "https://github.com/breautek/cordova-plugin-file.git#feat/api30"
       }
   }
   
   ### Version information
   <!-- 
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins 
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android 10
   -->
   
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [ x] I searched for existing GitHub issues
   - [ ] I updated all Cordova tooling to most recent version
   - [ ] I included all the necessary information above
   


-- 
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-unsubscribe@cordova.apache.org

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



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


[GitHub] [cordova-plugin-file] breautek edited a comment on issue #496: Cannot read or delete files under cordova.file.externalRootDirectory for Android 10

Posted by GitBox <gi...@apache.org>.
breautek edited a comment on issue #496:
URL: https://github.com/apache/cordova-plugin-file/issues/496#issuecomment-926070919


   Can't promise **when**... but I'll try to add this case to my [Test App](https://github.com/breautek/cordova-file-api30-test-app)
   
   Although, I'm pretty sure `/storage/emulated/0/` (aka externalRootDirectory) is not a writable directory starting in API 30, and a deletion and any other modifying action I would assume is considered a write.


-- 
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-unsubscribe@cordova.apache.org

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



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


[GitHub] [cordova-plugin-file] breautek edited a comment on issue #496: Cannot read or delete files under cordova.file.externalRootDirectory for Android 10

Posted by GitBox <gi...@apache.org>.
breautek edited a comment on issue #496:
URL: https://github.com/apache/cordova-plugin-file/issues/496#issuecomment-926070919


   Can't promise **when**... but I'll try to add this case to my [Test App](https://github.com/breautek/cordova-file-api30-test-app)
   
   Although, I'm pretty sure `/storage/emulated/0/` (aka externalRootDirectory) is not a writable directory starting in API 30, and a deletion and any other modifying action I would assume is considered a write.
   
   In my test app, I was able to read files however from the externalRootDirectory, as long as the `READ_EXTERNAL_STORAGE` permission was granted.


-- 
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-unsubscribe@cordova.apache.org

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



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


[GitHub] [cordova-plugin-file] necrodamus commented on issue #496: Cannot read or delete files under cordova.file.externalRootDirectory for Android 10

Posted by GitBox <gi...@apache.org>.
necrodamus commented on issue #496:
URL: https://github.com/apache/cordova-plugin-file/issues/496#issuecomment-926086359


   Thanks a lot Breautek i have these permisions to write and read , but is not working, i hope in the future a fix. 
   ![image](https://user-images.githubusercontent.com/26715966/134569839-c5b06861-5aa3-4947-aeff-afeaae637ff0.png)
   


-- 
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-unsubscribe@cordova.apache.org

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



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


[GitHub] [cordova-plugin-file] breautek commented on issue #496: Cannot read or delete files under cordova.file.externalRootDirectory for Android 10

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #496:
URL: https://github.com/apache/cordova-plugin-file/issues/496#issuecomment-926070919


   Can't promise **when**... but I'll try to add this case to my [Test App](https://github.com/breautek/cordova-file-api30-test-app)


-- 
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-unsubscribe@cordova.apache.org

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



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


[GitHub] [cordova-plugin-file] hardslk commented on issue #496: Cannot read or delete files under cordova.file.externalRootDirectory for Android 10

Posted by GitBox <gi...@apache.org>.
hardslk commented on issue #496:
URL: https://github.com/apache/cordova-plugin-file/issues/496#issuecomment-1076307530


   Hey,
   I am also facing the same issue for android 11.
   after giving MANAGE_EXTERNAL_STORAGE its work but my application reject in play store.
   
   so, please help as soon as possible.


-- 
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-unsubscribe@cordova.apache.org

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



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


[GitHub] [cordova-plugin-file] breautek commented on issue #496: Cannot read or delete files under cordova.file.externalRootDirectory for Android 10

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #496:
URL: https://github.com/apache/cordova-plugin-file/issues/496#issuecomment-926792774


   Google doesn't really provide any concrete details but [they do say](https://developer.android.com/about/versions/11/privacy/storage#permissions-target-11)
   
   > If your app targets Android 11, both the WRITE_EXTERNAL_STORAGE permission and the WRITE_MEDIA_STORAGE privileged permission no longer provide any additional access.
   
   `WRITE_EXTERNAL_STORAGE` is the permission originally required to write to any file in external storage (that is `/sdcard/` for devices with an actual sd card or `/storage/emulated/0/` for devices with emulated external storage, which are most modern devices today). As of API 30, `WRITE_EXTERNAL_STORAGE` does not grant any special behaviours, and is essentially ignored/no-op. In my testing, you can write to certain external file paths, e.g. `Downloads/`, `Media/`, `Pictures/`, etc... but apps can no longer modify files under the external directories unless if the app itself was the creator of the file (at least that's my current interpretation/understanding of the [google android docs](https://developer.android.com/training/data-storage/shared/media#request-permissions)).
   
   If you're using a plugin such as the camera plugin to obtain pictures, it would be important to note that your app **is not** the creator of the image, and instead the Camera app on the device is. Therefore you should have read access with `READ_EXTERNAL_STORAGE` permission granted, but you cannot write or make modifications to the file. You **should** be able to write a copy of that file under a different filename.


-- 
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-unsubscribe@cordova.apache.org

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



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


[GitHub] [cordova-plugin-file] brunoalex commented on issue #496: Cannot read or delete files under cordova.file.externalRootDirectory for Android 10

Posted by GitBox <gi...@apache.org>.
brunoalex commented on issue #496:
URL: https://github.com/apache/cordova-plugin-file/issues/496#issuecomment-974243235


   i am trying to acess device galery to select a picture and upload it ...but its not working with sdk30, im geting file:///data/user/0/events.staff.booking.app/cache/myimage.jpg?1637341097796 to upload but it failes...and i cant get acess to the image on that path
   


-- 
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-unsubscribe@cordova.apache.org

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



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


[GitHub] [cordova-plugin-file] necrodamus edited a comment on issue #496: Cannot read or delete files under cordova.file.externalRootDirectory for Android 10

Posted by GitBox <gi...@apache.org>.
necrodamus edited a comment on issue #496:
URL: https://github.com/apache/cordova-plugin-file/issues/496#issuecomment-926086359


   Thanks a lot Breautek i have these permisions to write and read , but is not working, i hope in the future a fix. 
   ![image](https://user-images.githubusercontent.com/26715966/134569839-c5b06861-5aa3-4947-aeff-afeaae637ff0.png)
   The strange of this , the sdk is only in android 11 not android 10.
   But i have the same problem
   Android 11 (nivel de API 30)
   Para obtener detalles sobre los cambios en la plataforma, consulta la documentación de Android 11.
   
   Android 10 (nivel de API 29)
   Para obtener detalles sobre los cambios en la plataforma, consulta Android 10 para desarrolladores.
   
   


-- 
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-unsubscribe@cordova.apache.org

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



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