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/11/23 16:47:09 UTC
[GitHub] [cordova-plugin-file] breautek commented on issue #426: Storage updates in Android 11
breautek commented on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-976837409
Addressing a few comments over the past few days:
> but the the file path isent acessible , i get no acessible path only console log "sucess:"
You're only getting `"success:` because that's the only thing you're logging out.
Instead of doing: `console.log("sucess:")+s;` I think you mean:
```
console.log("sucess:", s);
```
> cant acess the file :/ in sdk 30
The root `/` folder is protected. You can only access files under your application internal directory (See the [File system directory table](https://github.com/apache/cordova-plugin-file#android-file-system-layout). Anything that isn't explicitly marked as external in this table are internal directories.
> Not allowed to load local resource: file:///storage/emulated/0/app_media/1637263763703.jpg
Starting with cordova-android@10, cordova-android uses [WebViewAssetLoader](https://developer.android.com/reference/androidx/webkit/WebViewAssetLoader) by default and disables local file system access as recommended by the android docs. This is because this option is deemed insecure, but was a critical component that Cordova that depended on with on other alternative until Android introduced the WebViewAssetLoader. Using the WebViewAssetLoader also overcomes some other same-origin issues as requests appear to come from a true origin rather than the filesystem which has a `null` origin. More information on this change in our [blog release notes](https://cordova.apache.org/announcements/2021/07/20/cordova-android-10.0.0.html).
This also means you can't use use file system urls directly like before. I think I might have to make a blog post about this but you can still read the file (assuming you have access to that file) as a blob and use [Object URLs](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL).
Alternatively, if you want the previous cordova-android behaviour, you can enable the `AndroidInsecureFileModeEnabled` preference in your `config.xml` file.
This is not related to the cordova-plugin-file, so I would respectfully ask to refrain from posting more on this. If you have further questions on this, you can reach reach out to our [Slack](https://join.slack.com/t/cordova/shared_invite/zt-z70vy6tx-7VNulesO0Qz0Od9QV4tc1Q) community. (Link is a temporary link since the main link is down at the time of writing...)
> MANAGE_EXTERNAL_STORAGE
Note that adding the [MANAGE_EXTERNAL_STORAGE](https://developer.android.com/training/data-storage/manage-all-files) permission may work for you but it also may limit your ability to deploy to the Google Play store. This permission will require justification and Google reserves the right to block your app from the play store if they feel like your app don't *need* this permission.
--
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