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 2020/10/01 07:03:21 UTC

[GitHub] [cordova-plugin-file] HarelM opened a new issue #426: Storage updates in Android 11

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


   # Feature Request
   Support the android 11 new file system based policy.
   
   ## Motivation Behind Feature
   Support the changes that are planned for android 11 (API level 30)
   
   ## Feature Description
   I'm not sure how to fully describe this, but basically support what's documented here:
   https://developer.android.com/about/versions/11/privacy/storage 
   
   ## Alternatives or Workarounds
   Not targeting API level 30 until this is supported?
   
   


----------------------------------------------------------------
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.

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] drogerie21 commented on issue #426: Storage updates in Android 11

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


   > Hello, I was facing a similar problem, when I needed to read a file from the storage of an Android device, the plugin returns null in the contents of the file.
   > 
   > The reason for this is the "partial" permission implemented in Android 11, although the user gives the storage permission this always stays in "only multimedia content".
   > 
   > So what I did was send the user to the settings section of the app and tell them to change the storage permission to "allow access to all files".
   > And with that change I was already able to read the files in any directory on the device on Android 11.
   > 
   > Note:
   > You need to implement this in your config.xml for the storage permission to work well on Android 11
   > ` <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />`
   > 
   > I hope and this will help you.
   
   Unfortunately this is not working for me!
   I try to write  a file from a html input tag. This is working with eg files from the Downloads-Folder. But it is not working with files from google drive. Setting the permission to accal all files  ("android.permission.MANAGE_EXTERNAL_STORAGE") does not change this behaviour. I get this error message:
   `DOMException: The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.`


-- 
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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   Tell the user to allow the app to access all files is not a good practice,
   it poses potential security problems and it is exactly that which Google
   was trying to avoid with the new policies on Android 11.
   
   A sábado, 5/06/2021, 16:41, Joshua Eduardo González Ruíz <
   ***@***.***> escreveu:
   
   > Hello, I was facing a similar problem, when I needed to read a file from
   > the storage of an Android device, the plugin returns null in the contents
   > of the file.
   >
   > The reason for this is the "partial" permission implemented in Android 11,
   > although the user gives the storage permission this always stays in "only
   > multimedia content".
   >
   > So what I did was send the user to the settings section of the app and
   > tell them to change the storage permission to "allow access to all files".
   > And with that change I was already able to read the files in any directory
   > on the device on Android 11.
   >
   > Note:
   > You need to implement this in your config.xml for the storage permission
   > to work well on Android 11
   >
   > I hope and this will help you.
   >
   > —
   > You are receiving this because you were mentioned.
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-855249720>,
   > or unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/AA6M4DLMZZOLJK7STKAVVOLTRIZR7ANCNFSM4SAAWWGQ>
   > .
   >
   


-- 
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.

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] joshuaokpako commented on issue #426: Storage updates in Android 11

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


   I am using ionic 4 and I faced the same issue so I tried the ionic 4 version of resolveDirectoryUrl(cordova.file.externalRootDirectory, function (dirEntry) {)) and on success function I used dirEntry.getDirectory ('Download'... and I can create folders and save files to the Download folders on android 11 without adding android:requestLegacyExternalStorage="true". Here is the code for ionic 4. I have also tried to convert it to the normal web version.
   ```
   createDirectory(rootDir) {
       return new Promise((res, rej) => {
         this.file.resolveDirectoryUrl(rootDir).then((rootDirEntry)=>{
           
           rootDirEntry.getDirectory('Download', { create: false, exclusive:false},  (dirEntry) =>{
             dirEntry.getDirectory('updates', { create: true, exclusive:false}, (subDirEntry) =>{
               this.updateDir = subDirEntry;
               this.appDir = dirEntry;
               res(this.updateDir)
             }, (err)=> {
               this.onErrorGetDir(rootDir+'Download/','updates');
               rej(err)
             })
           }, (err)=> {
             this.onErrorGetDir(rootDir,'Download')
             rej(err)
           })
         })
         
       })
     }
   ```
   and the normal web version. Note that I have only tested the ionic 4 version of this code. 
   ```
   function createDirectory(rootDir /*cordova.file.externalRootDirectory*/) {
       window.resolveDirectoryURL(rootDir, function (rootDirEntry) {
         dirEntry.getDirectory('Download', { create: false, exclusive:false}, function (dirEntry) {
           dirEntry.getDirectory('updates', { create: true, exclusive:false}, function (subDirEntry) {
               /* delete a file or donwload a file using cordova-plugin-advanced-http.
                   I tested mine using cordova-plugin-advanced-http to download a file to this folder */
               createFile(subDirEntry, "fileInNewSubDir.txt");
   
           }, onErrorGetDir);
         }, onErrorGetDir);
       })
     }
   ```
   This doesn't allow you to write or read from the root directory but works with the download directory and probably other sub directories in the root directory.
   You will need READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions. 


-- 
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.

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] israeltrejo commented on issue #426: Storage updates in Android 11

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


   I changed the android version in which the application is focused adding this tag in the config.xml:
   `<preference name="android-targetSdkVersion" value="28" />`
   And this change allows to save files into the device using on Android 8, Android 9, Android 10 and Android 11.
   I did tests on Android emulator and physical devices working correctly.
   
   The Android documentation recommends to change the API Level version to avoid the scoped storage feature on Android 10.
   
   You get more information about scoped storage feature here:
   https://developer.android.com/training/data-storage/use-cases#opt-out-scoped-storage


-- 
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] hanslbua commented on issue #426: Storage updates in Android 11

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


   Does anyone has a solution for the problem with SDKVersion 30?


-- 
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] Yura13 commented on issue #426: Storage updates in Android 11

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


   @hanslbua 
   
   ```
   import { File } from '@ionic-native/file/ngx';
   import { FileTransfer, FileTransferObject } from '@ionic-native/file-transfer/ngx';
   .....
     constructor(
       private file: File,
       private transfer: FileTransfer,
     ) {
     }
   ....
     async download(url: string, fileName: string): Promise<string> {
       const directoryPath: string = this.isIOS ? this.file.documentsDirectory : `${this.file.externalDataDirectory}Download/`;
       const fileTransfer: FileTransferObject = this.transfer.create();
       const entry = await fileTransfer.download(url, `${directoryPath}${fileName}`);
       return entry.toURL();
     }
   ....
   ```
   
   package.json
   ```
   ...
       "@ionic-native/file": "^5.15.0",
       "@ionic-native/file-transfer": "^5.30.0",
       "cordova-plugin-file": "^6.0.2",
       "cordova-plugin-file-transfer": "git+https://github.com/apache/cordova-plugin-file-transfer.git",
   ...
   ```
   


-- 
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] harisrnd commented on issue #426: Storage updates in Android 11

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


   I believe that until this plugin code adapts to the new android 30 requirements the only clean option is to store only locally and transfer data from and to other plugins that have adapted(if possible). For example, get the images from the camera plugin in base64 and store locally(cordova.file.dataDirectory).


-- 
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] skmbr commented on issue #426: Storage updates in Android 11

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


   I've read through this entire thread (trying to follow as much as I can), the Google docs on scoped storage, and other issues and stackoverflow posts and I'm still not 100% sure that this issue applies to me, so if anyone can tell me I'd really appreciate it...
   
   For a feature I'm working on (involving opening a video, overlaying text on it with canvas, and capturing the output) I need the video and page to be same origin. So I've tried to use API30 and cordova-android@10.0.1 for the WebViewAssetLoader functionality to serve my app from https://localhost.
   
   The problem I have is that after updating (from API29 / cordova-android@9.1), when I select a video from the photo library, using previously working code like this:
   
   ```
             navigator.camera.getPicture(
               file => {
                 file = file.indexOf('file://') === 0 ? file : 'file://' + file
                 window.resolveLocalFileSystemURL(file, (fileEntry) => {
                   this.video = fileEntry.toInternalURL() // Vue.js data property that populates video src
                 })
               },
   
               () => {},
   
               {
                 destinationType: Camera.DestinationType.FILE_URI,
                 sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
                 mediaType: Camera.MediaType.VIDEO
               }
             )
           }
   ```
   ... I get an error like this in the console:
   
   `GET cdvfile://localhost/sdcard/DCIM/Camera/VID_20210802_200106.mp4 net::ERR_UNKNOWN_URL_SCHEME`
   
   If I go back to API29 / cordova-android@9.1 it works fine again.
   
   Where I'm not sure if this is the same issue is from comments like this one by @HarelM https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-751977160 :
   
   > @Vatsov Are you reading a file a user selects? If so I don't think there's an issue that is related to Android 11, or at least I hope not as you open the file picker and this should be OK even in Android 11 as far as I know.
   
   ...and things that I read in google's docs that seem to suggest that reading the users photo/video library is treated differently to accessing other types of file.
   
   Regardless, I've still tried adding the MANAGE_EXTERNAL_STORAGE permission, but that hasn't seemed to have any effect.
   
   So can anyone tell me if this is the same issue? Or is it a different one caused by the upgrade to API30 and/or cordova-android@10.0.1 ?
   
   To be honest I'm feeling a little out of my depth here and would very much like to get back to my cosy javascript safe place! :)
   
   Thanks in advance for any help or suggestions!


-- 
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] Maheshvy removed a comment on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
Maheshvy removed a comment on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-981407318


   **I tried with below code in Androidmainfest file**
   
   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.ACTION_MANAGE_STORAGE" />
   <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
   
   
   
   **Config.xml file**
   <preference name="AndroidInsecureFileModeEnabled" value="true" />
   <preference name="AndroidPersistentFileLocation" value="Compatibility" />


-- 
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] Vatsov commented on issue #426: Storage updates in Android 11

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


   > @olsbg this won't work for android 11, it does and will work for android 10.
   > I've migrated my entire code that saves file to the external file system to share files that are created in memory to avoid any future limitations...
   
   Can you share how you achieved this?


----------------------------------------------------------------
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.

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] victorvhpg edited a comment on issue #426: Storage updates in Android 11

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


   Me
   
   > > i wanna save a file, not share a file 
   > 
   > You can save a file but you have to use the application directories, which are not accessible to the user, you can use `cordova.file.applicationStorageDirectory` which is read/write.
   > 
   > If you want to save a file for the user to later open (for example a pdf), you have to use `cordova.file.externalRootDirectory`. And right now, on Android 11+ you can't, unless you use the workaround I mentioned.
   
   I need save to a shared folder like cordova.file.externalRootDirectory (write/read) but Google will remove apps that use requestLegacyExternalStorage


-- 
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.

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 #426: Storage updates in Android 11

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


   ## What should work
   
   > window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory + "/Download" used to work 
   
   - This should work as is when targeting API 28 (now forbidden by Google Play)
   - This should work when targeting API 29 with the dev version of the plugin (which has the `android:requestLegacyExternalStorage="true"`), alternatively you can use the [edit-config](https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#edit-config) to add this flag.
   - This won't work when targeting API 30, as API 30 ignores the `android:requestLegacyExternalStorage` attribute.
   
   It's important to read the [Android Notes](https://developer.android.com/training/data-storage/use-cases#migrate-legacy-storage) before you target API 30. You may need to migrate your files to another folder to maintain access to them when targeting API 30 using the new APIs.
   
   ## Who this will affect
   
   This will affect any app that reads or writes to the external file system (aka the `cordova.file.external*`). If you don't use external file paths, then you probably don't need any changes in your app.
   
   I'll be adding a help wanted label. We don't have a planned solution yet. If a volunteer would take the lead and finding a solution to prepare a PR, I encourage to use our [Dev Mailing List](https://cordova.apache.org/contact/) so that we can discuss requirements and potential solutions.
   
   Useful Links: https://developer.android.com/about/versions/11/privacy/storage


----------------------------------------------------------------
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   @interstellerS I know the thread is long, but we have already discussed that previously.
   
   The current **workaround** is to use the npm version of this plugin and not the dev version, just run to be sure you're using the npm version
   
   ```
   cordova plugin rm cordova-plugin-file
   cordova plugin add cordova-plugin-file
   ```
   
   The npm version does not use `requestLegacyExternalFlag` on which Google complains, on and after Android 11.
   
   Then install the plugin [`cordova-plugin-x-socialsharing`](https://www.npmjs.com/package/cordova-plugin-x-socialsharing) and use the `options.files` Array property. This let the users save the file wherever they want, instead of you trying to find the correct path. If you want to be sure your users are able to share to the file system, you can suggest them to install this [simple APP](https://play.google.com/store/apps/details?id=com.boxhead.android.sharetofilesystem&hl=en_US&gl=US), which is indeed just an addon (it will not create any new icon and it's not openable, it simply allows users to share a file to the file system).


-- 
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.

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] HarelM commented on issue #426: Storage updates in Android 11

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


   Check the file size. File larger than 25 mb won't be attached. I have no issues with the plugin and gmail, I use it for reporting an issue in my app to attach log files.


-- 
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.

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] joshuaokpako commented on issue #426: Storage updates in Android 11

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


   @jfoclpf I am using ionic 4 and the ionic cordova plugin is built on this file plugin. I have attached the link to the ionic 4 website that references this plugin https://ionicframework.com/docs/native/file


-- 
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   Thank you @HarelM , regarding point 1. could you kindly tell me exactly which social sharing plugin do you use?


-- 
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.

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] JoshuaEGonzalezRuiz commented on issue #426: Storage updates in Android 11

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


   > Tell the user to allow the app to access all files is not a good practice, it poses potential security problems and it is exactly that which Google was trying to avoid with the new policies on Android 11. A sábado, 5/06/2021, 16:41, Joshua Eduardo González Ruíz < ***@***.***> escreveu:
   > […](#)
   
   I know, but that was the only way I could get the process going. If I find any other way, I will gladly share it around here until there is an official form.


-- 
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.

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] HarelM commented on issue #426: Storage updates in Android 11

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


   Instead of saving files to the file system I use the social sharing plugin. This way a user is prompted with options on what he wants to do with the file I just created in memory:
   https://github.com/IsraelHikingMap/Site/blob/4e479a5a92051ae5ec84136ca8c20547a4d11f26/IsraelHiking.Web/sources/application/services/file.service.ts#L152


----------------------------------------------------------------
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.

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] Vatsov edited a comment on issue #426: Storage updates in Android 11

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


   @HarelM  Yes, I’m trying to read the file which the user selects with `this.fileChooser.open()`
   The interesting thing is that `this.file.checkFile` returns true, but when I try with `this.file.readAsText` it returns `null`
   
   So I decided firstly to copy the file to `this.file.dataDirectory` and after that to read it but the `this.file.copyFile` but returns `FileError {code: 1, message: "NOT_FOUND_ERR"}`


----------------------------------------------------------------
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.

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] Davparis commented on issue #426: Storage updates in Android 11

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


   Here is my case :
   
   I have an app in production that actually :
   - target API29, with android:requestLegacyExternalStorage="true"
   - and use :
   1) cordova.file.externalRootDirectory 
   2) file path to external card, if the external card exits, via cordova.plugins.diagnostic.getExternalSdCardDetails
   
   According to my tests, with a device using Android 11 (API 30) and android:requestLegacyExternalStorage="false" in AndroidManifest.xml
   - I can read an existing file
   - but can't create a new one
   
   To support the changes requested by Google, I'm planning to :
   - check if access to external is actually granted via cordova.plugins.diagnostic.requestExternalStorageAuthorization
   and then :
   - copy user existing files (as far as i can read them) to cordova.file.dataDirectory
   - delete existing files (if possible, not tested)
   - put a variable in localstorage, so that the app use cordova.file.dataDirectory for the next starts.
   
   If it is a fresh install, I would use only cordova.file.dataDirectory for storing the new files.
   
   But i'm stuck for the access to external card.
   Is there a way to get a path to a folder in external card, even if that path is acceded only by my application ?
   
   What is strange is that the path returned by getExternalSdCardDetails seems to use a sandboxed folder :
   file:///storage/0123-4567/Android/data/com.mycompany.myapp/files/
   


-- 
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   @HarelM check the [differences](https://github.com/apache/cordova-plugin-file/compare/24dba9f4f9e6cdb17c5e11959df5a5785f1aa6e6..5274cab39e3f96a8682a74ba28663f32611501c8) between the npm latest version 6.0.2 and this github dev version.
   
   The differences in the core code, if I could fully understand, are negligible 
   
   The npm version does not have the flag `requestLegacyExternalStorage` to true, so my advice is to use the npm version, that is what I plan to do
   
   ```
   cordova plugin rm https://github.com/apache/cordova-plugin-file.git
   cordova plugin add cordova-plugin-file
   ```
   
   That said, I also agree with you that that flag should be set to false. You can find it [here](https://github.com/apache/cordova-plugin-file/blob/master/plugin.xml#L136).
   
   


-- 
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   @joshuaokpako ah, now I see, you are using the npm version (`npm install cordova-plugin-file`) and not the dev version and in the npm version `android:requestLegacyExternalStorage` is _not_ set to `true`. Thus it works.


-- 
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.

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] victorvhpg removed a comment on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
victorvhpg removed a comment on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-879996416


   Any update?? 


-- 
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] jfoclpf edited a comment on issue #426: Storage updates in Android 11

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


   > Or is there a way to use this plugin on the 'Files' android app so the user can save the file on his device ?
   
   I recommend my users to simply install [this sinple and light add-on](https://play.google.com/store/apps/details?id=com.boxhead.android.sharetofilesystem&hl=en_US&gl=US), I'd say it's not even an app, it simply allows you to share to file system. But any file system app allows you to do that.


-- 
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.

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] krunalsk007 commented on issue #426: Storage updates in Android 11

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


   > @breautek please highlight your comment about the test fork you created, because people are not reading it since the thread is becoming too long.
   > 
   > Newcomers: test the following fork because it was made to overcome all the problems related with storage on Android 11 and beyond
   > 
   > ```
   > cordova plugin add https://github.com/breautek/cordova-plugin-file/tree/feat/api30
   > ```
   > 
   > and downgrade to cordova 9.1 if necessary (latest is 10)
   > 
   > ```
   > npm i -g cordova-android@9.1
   > ```
   > 
   > More info here: [#426 (comment)](https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-830841544)
   
   but google not allowed android api 29 anymore we must have to update api level 30 which is only possible by cordova 10.0.0
   so we must solved this issue to upload new apk in playstore.


-- 
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] darnok333 edited a comment on issue #426: Storage updates in Android 11

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


   Hello,
   I just want to share a solution I found to my problem as it's related to this thread.
   
   
   **Problem with SDK 30 :**
   Our team used the path externalApplicationStorageDirectory to store some assets of the application, wich are downloaded the first time the user connect to the application.
   But we weren't able to access those files, and got an ACCESS_DENIED error.
   
   
   **Solution :**
   I made a little modification in CordovaActivity.java in init() function
   
   ```
   protected void init() {
       appView = makeWebView();
       createViews();
       if (!appView.isInitialized()) {
           appView.init(cordovaInterface, pluginEntries, preferences);
       }
     
       /********** MODIFICATION SDK 30 **********/
           WebView webView = (SystemWebView)(appView.getEngine().getView());
           WebSettings webSettings = webView.getSettings();
           webSettings.setAllowFileAccess(true);
       /**********************************/
     
       cordovaInterface.onCordovaInit(appView.getPluginManager());
     
       // Wire the hardware volume controls to control media if desired.
       String volumePref = preferences.getString("DefaultVolumeStream", "");
       if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) {
           setVolumeControlStream(AudioManager.STREAM_MUSIC);
       }
    }
   ```
   
   
   you also need to add these import :
   
   ```
   import android.webkit.WebView;
   import android.webkit.WebSettings;
   import org.apache.cordova.engine.SystemWebView;
   ```
   
   
   Hope this can help some of you :)
   


-- 
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 #426: Storage updates in Android 11

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


   You need to be using build tools 29.
   
   https://cordova.apache.org/docs/en/dev/guide/platforms/android/index.html#adding-sdk-packages


----------------------------------------------------------------
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   @victorvhpg Google will not remove apps with that flag to true, it will simply ignore that flag on Android 11+. Google will remove indeed apps with `MANAGE_EXTERNAL_STORAGE` permission with no valid reason therefor.


-- 
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.

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] jfoclpf edited a comment on issue #426: Storage updates in Android 11

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


   @joshuaokpako ah, now I see, you are using the npm version (`npm install cordova-plugin-file`) and not the dev version and in the npm version `android:requestLegacyExternalStorage` is _not_ set to `true`. Thus it works (in theory just up to Android 10).


-- 
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.

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] Vatsov commented on issue #426: Storage updates in Android 11

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


   @HarelM  Yes, I’m trying to read the file which the user selects with `this.fileChooser.open()`
   The interesting thing is that `this.file.checkFile` returns true, but when I try with `this.file.readAsText` it returns `FileError {code: 1, message: "NOT_FOUND_ERR"}`


----------------------------------------------------------------
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.

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] ChrisHSandN commented on issue #426: Storage updates in Android 11

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


   I am not sure which part of the cordova stack is responsible for this but setting an img src attribute to the `file://` address of a stored image retrieved using this plugin and `FileEntry.toURL()` used to work fine. However now:
   
   `<img src="FileEntry.toURL()">` results in:
   > Not allowed to load local resource: file:///storage/emulated/0/Android/data/...
   
   `<img src="FileEntry.toInternalURL()">` results in:
   > Failed to load resource: net::ERR_UNKNOWN_URL_SCHEME
   
   I think this is the same as the issue over on https://github.com/apache/cordova-plugin-camera/issues/761


-- 
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] atebsy commented on issue #426: Storage updates in Android 11

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


   > Chooser
   
   @Vatsov file chooser also returns base64 data, you can convert that into blob, then use the this.file.writeFile() method to save the file into your app directory


-- 
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.

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] erisu closed issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
erisu closed issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426


   


-- 
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] sachithd commented on issue #426: Storage updates in Android 11

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


   > i still cant acess my file , im using +1 `window.FilePath.resolveNativePath('file:///data/user/0/events.staff.booking.app/cache/FB_IMG_1637505177709.jpg', successCallback, errorCallback); function successCallback(s){ console.log("sucess:")+s; } function errorCallback(e){ console.log("error:")+e; `
   > 
   > but the the file path isent acessible , i get no acessible path only console log "sucess:"
   
   After making the change to the FilePath.java in plugins folder, have you tried removing and adding the Android platform?


-- 
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 #426: Storage updates in Android 11

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


   i still cant acess my file , im using 👍 
   `window.FilePath.resolveNativePath('file:///data/user/0/events.staff.booking.app/cache/FB_IMG_1637505177709.jpg?', successCallback, errorCallback);
   function successCallback(s){
    console.log("sucess:")+s;	
   }
   function errorCallback(e){
   console.log("error:")+e;	 
   `
   
   but the the file path isent acessible 


-- 
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] Topiya commented on issue #426: Storage updates in Android 11

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


   > `Starting November 1, 2021, updates to apps and games on Google Play will be required to target Android 11 (API level 30) or higher.`
   > 
   > I have tried to apply a couple of solutions from this thread but it didn't work.
   > 
   > Also, I've tried manually adding the needed permission but 'android.permission.MANAGE_EXTERNAL_STORAGE' don't appear in `AndroidManifest.xml` after I add to config.xml next part:
   > 
   > ```
   >     <config-file file="app/src/main/AndroidManifest.xml" mode="merge" parent="/manifest" xmlns:android="http://schemas.android.com/apk/res/android">
   >       <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
   >     </config-file>
   > ```
   > 
   > package.json
   > 
   > ```
   >     "cordova-android": "^9.1.0",
   >     "cordova-js": "^5.0.0",
   > ```
   
   @Yura13  Is it generating Android target: android-30 ?
   because When I try to add "cordova-android": "^9.1.0" it shows Android target: android-29 not 30
   
   


-- 
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] Topiya commented on issue #426: Storage updates in Android 11

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


   > `Starting November 1, 2021, updates to apps and games on Google Play will be required to target Android 11 (API level 30) or higher.`
   > 
   > I have tried to apply a couple of solutions from this thread but it didn't work.
   > 
   > Also, I've tried manually adding the needed permission but 'android.permission.MANAGE_EXTERNAL_STORAGE' don't appear in `AndroidManifest.xml` after I add to config.xml next part:
   > 
   > ```
   >     <config-file file="app/src/main/AndroidManifest.xml" mode="merge" parent="/manifest" xmlns:android="http://schemas.android.com/apk/res/android">
   >       <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
   >     </config-file>
   > ```
   > 
   > package.json
   > 
   > ```
   >     "cordova-android": "^9.1.0",
   >     "cordova-js": "^5.0.0",
   > ```
   
   Is it generating Android target: android-30 ?
   because When I try to add "cordova-android": "^9.1.0" it shows Android target: android-29 not 30
   
   


-- 
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] Yura13 commented on issue #426: Storage updates in Android 11

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


   @Topiya 
   Yes
   
   ```
           <preference name="android-minSdkVersion" value="22" />
           <preference name="android-targetSdkVersion" value="30" />
   ```


-- 
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] danicarla commented on issue #426: Storage updates in Android 11

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


   > @alex-steinberg i can acess the file, but the funtions i used to upload the file after selecting from the galery to the server arent working in sdk30.. "ft.upload(imageURI, server, function(r)" ...
   
   I have a similar problem.. my app downloads and unzips images in _///storage/emulated/0/Android/data/myappid/files/_ but the app cannot access the images by javascript or by code ex. `<img src="///storage/emulated/0/Android/data/myappid/files/image.png">`
   
   looks very confused


-- 
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] israeltrejo edited a comment on issue #426: Storage updates in Android 11

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


   I changed the android version in which the application is focused adding this tag in the config.xml:
   `<preference name="android-targetSdkVersion" value="28" />`
   And this change allows to save files into the device using on Android 8, Android 9, Android 10 and Android 11.
   I did tests on Android emulator and physical devices working correctly.
   
   The Android documentation recommends to change the API Level version to avoid the scoped storage feature on Android 10.
   
   You get more information about scoped storage feature here:
   https://developer.android.com/training/data-storage/use-cases#opt-out-scoped-storage
   
   I hope this information will be helpful.


-- 
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] darnok333 edited a comment on issue #426: Storage updates in Android 11

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


   Hello,
   I just want to share a solution I found to my problem as it's related to this thread.
   
   
   **Problem with SDK 30 :**
   Out team used the path externalApplicationStorageDirectory to store some assets of the application, wich are downloaded the first time the user connect to the application.
   But we weren't able to access those files, and got an ACCESS_DENIED error.
   
   
   **Solution :**
   I made a little modification in CordovaActivity.java in init() function
   
   ```
   protected void init() {
       appView = makeWebView();
       createViews();
       if (!appView.isInitialized()) {
           appView.init(cordovaInterface, pluginEntries, preferences);
       }
     
       /********** MODIFICATION SDK 30 **********/
           WebView webView = (SystemWebView)(appView.getEngine().getView());
           WebSettings webSettings = webView.getSettings();
           webSettings.setAllowFileAccess(true);
       /**********************************/
     
       cordovaInterface.onCordovaInit(appView.getPluginManager());
     
       // Wire the hardware volume controls to control media if desired.
       String volumePref = preferences.getString("DefaultVolumeStream", "");
       if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) {
           setVolumeControlStream(AudioManager.STREAM_MUSIC);
       }
    }
   ```
   
   
   you also need to add these import :
   
   ```
   import android.webkit.WebView;
   import android.webkit.WebSettings;
   import org.apache.cordova.engine.SystemWebView;
   ```
   
   
   Hope this can help some of you :)
   


-- 
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] angeltodorovyara edited a comment on issue #426: Storage updates in Android 11

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


   I store a created file inside files folder in the internal storage and i want the user to be able to send it via email using cordova-plugin-x-socialshearing. But when the Gmail app or Google Drive opens it says that the file couldn't be attached. I don't understand where the problem is, where this file must be stored... 


-- 
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.

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 #426: Storage updates in Android 11

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


   > I tested it now and it allows me to use cordova.file.externalRootDirectory + "/Download" in Android 10 (API 29)
   >
   >Yes, but you still need to use build tools version 29, otherwise the build will fail to recognize android:requestLegacyExternalStorage.
   >
   >Did you mean this in config.xml?
   
   "Build Tools" is part of the Android SDK, you can download it using the Android Studio's SDK Manager tool.
   
   ![Screenshot from 2021-01-11 19-26-05](https://user-images.githubusercontent.com/11200662/104249960-e450b000-5442-11eb-8be7-9c5193167270.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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   > > window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory + "/Download" used to work
   > * This should work when targeting API 29 with the dev version of the plugin (which has the `android:requestLegacyExternalStorage="true"`), 
   
   Did you mean running `cordova plugin add https://github.com/apache/cordova-plugin-file.git`
   Will be this backward compatible for API <= 28 also?


----------------------------------------------------------------
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.

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] ivanolarocca edited a comment on issue #426: Storage updates in Android 11

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






-- 
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] victorvhpg edited a comment on issue #426: Storage updates in Android 11

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


   > Hello, i found plugin for save image base64 in public directory, using api Media Store. Work in android 10 and 11.
   > I hope and this will help someone.
   > 
   > https://github.com/Heartade/cordova-plugin-android-mediastore
   
   
   
   @HarelM @breautek 
   Maybe the solution is mediaStore 


-- 
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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   > @jfoclpf Will this work on Android 11 sdk 30+ ?
   
   Yes, so far the feedback from the users is that it works 


-- 
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.

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] jfoclpf edited a comment on issue #426: Storage updates in Android 11

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


   > Or is there a way to use this plugin on the 'Files' android app so the user can save the file on his device ?
   
   I recommend my users to simply install [this simple and light add-on](https://play.google.com/store/apps/details?id=com.boxhead.android.sharetofilesystem&hl=en_US&gl=US), I'd say it's not even an app, it simply allows you to share to file system. But any file system app allows you to do that.


-- 
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.

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] angeltodorovyara commented on issue #426: Storage updates in Android 11

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


   I store a created file inside files folder in the internal storage and i want the user to want to send it via email using cordova-plugin-x-socialshearing. But when the Gmail app or Google Drive opens it says that the file couldn't be attached. I don't understand where the problem is, where this file must be stored... 


-- 
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.

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] rmeyers4 commented on issue #426: Storage updates in Android 11

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


   @anshuman61 : `MANAGE_EXTERNAL_STORAGE` is not a long-term solution. Once the Play Store requires applications to target API 30 later this year, Google is also cracking down on this permission and will not allow you to upload apps to the Play Store that use this permission unless the central purpose is file-system manipulation (a backup app, for example). Even in that case, you have to submit an application to attain this permission including a demonstration of why your app requires `MANAGE_EXTERNAL_STORAGE`.  
   
   See https://support.google.com/googleplay/android-developer/answer/10467955?hl=en#zippy=%2Cpermitted-uses-of-the-all-files-access-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


[GitHub] [cordova-plugin-file] chrisjdev commented on issue #426: Storage updates in Android 11

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


   I addressed the issue where the application could not access a file shared into the application by the user by instead forking cordova-plugin-filepath: https://github.com/VIAVI-Solutions/cordova-plugin-filepath/commit/a4714209cfbd2bd8eebad902b8f5ef3e34fb8baa


-- 
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] Topiya removed a comment on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
Topiya removed a comment on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-972723806


   > `Starting November 1, 2021, updates to apps and games on Google Play will be required to target Android 11 (API level 30) or higher.`
   > 
   > I have tried to apply a couple of solutions from this thread but it didn't work.
   > 
   > Also, I've tried manually adding the needed permission but 'android.permission.MANAGE_EXTERNAL_STORAGE' don't appear in `AndroidManifest.xml` after I add to config.xml next part:
   > 
   > ```
   >     <config-file file="app/src/main/AndroidManifest.xml" mode="merge" parent="/manifest" xmlns:android="http://schemas.android.com/apk/res/android">
   >       <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
   >     </config-file>
   > ```
   > 
   > package.json
   > 
   > ```
   >     "cordova-android": "^9.1.0",
   >     "cordova-js": "^5.0.0",
   > ```
   
   Is it generating Android target: android-30 ?
   because When I try to add "cordova-android": "^9.1.0" it shows Android target: android-29 not 30
   
   


-- 
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] Yura13 edited a comment on issue #426: Storage updates in Android 11

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


   @Topiya 
   Yes.
   You probably need to change the next lines in config.xml:
   
   ```
           <preference name="android-minSdkVersion" value="22" />
           <preference name="android-targetSdkVersion" value="30" />
   ```


-- 
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 #426: Storage updates in Android 11

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


   i did, but i just realise that if i run window.open on my path : "file:///data/user/0/events.staff.booking.app/cache/FB_IMG_1637505177709.jpg" .. the image opens ... i just cant get it to upload to my server dont know why i get upload code:1 ... using file-tranfere plugin ...
   


-- 
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] Topiya removed a comment on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
Topiya removed a comment on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-977689771


   I have added AndroidInsecureFileModeEnabled in config.xml but it is not woking for me.


-- 
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] Maheshvy commented on issue #426: Storage updates in Android 11

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


   **I tried with below code in Androidmainfest file**
   
   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.ACTION_MANAGE_STORAGE" />
   <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
   
   
   
   **Config.xml file**
   <preference name="AndroidInsecureFileModeEnabled" value="true" />
   <preference name="AndroidPersistentFileLocation" value="Compatibility" />


-- 
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] Maheshvy edited a comment on issue #426: Storage updates in Android 11

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


   #please let me know I'm also facing same issue for android 11 device (Cordova android@10 ).
   code :
   
   window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory, function(dir) {
       dir.getFile("test.pdf", {create:true}, function(file) {
           file.createWriter(function(fileWriter) {
           fileWriter.write("byteArrays data");
               alert('Message', 'File Downloaded Successfully');
           }, function(){
               alert('Error!', "Unable to save the file");
           });
       },function(e){
           alert('Error!', e);
       });
   },function(e){
       console.log(e);
   });
   
   


-- 
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] jfoclpf edited a comment on issue #426: Storage updates in Android 11

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


   Thank you so much @breautek 
   but I really don't know either how come Play Store is complaining about `MANAGE_EXTERNAL_STORAGE` in my cordova app, because my [`config.xml`](https://github.com/jfoclpf/form-for-parking-violation/blob/master/config.xml) does not make any reference to `MANAGE_EXTERNAL_STORAGE`. If my cordova APP has set this `MANAGE_EXTERNAL_STORAGE` where should it be? How can I turn it off?


-- 
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.

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 #426: Storage updates in Android 11

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


   API 29 enforces the scoped storage rules and that's what the legacy flag is for. To opt out of the new storage constraints. It was always meant to be a temporary flag with API 30 completely ignoring it and enforcing scoped storage constraints.
   
   While removing the flag will have to be done eventually, it alone is not going to solve API 30 changes.
   
   If you're app have no real reason to use external storage, then yes, it's probably best to migrate to internal storage. Internal storage is completely sandboxed and your app can read/write to this sandbox with no special permissions.
   
   If time permits, I'd like to start experimenting with solutions next weekend.


-- 
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.

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] victorvhpg edited a comment on issue #426: Storage updates in Android 11

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


   > Right now on Android 11 you can't
   > […](#)
   
   I know that. This a big issue. This plugin need to use MediaStore API for that issue


-- 
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.

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] jfoclpf edited a comment on issue #426: Storage updates in Android 11

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


   Thank you @breautek , I will check it out
   
   If I understood correctly, it seems that a way to overcome the objections raised by new policy on Android 11+ is to use the [Storage Access Framework](https://developer.android.com/guide/topics/providers/document-provider). This Framework opens a system file picker and we can use it to open or save files with the intents `ACTION_OPEN_DOCUMENT` or `ACTION_CREATE_DOCUMENT`. 
   
   This plugin could have a method that would trigger these intents with a file picker, something like `cordova.file.openFilePicker`
   
   ```java
   // Request code for creating a PDF document.
   private static final int CREATE_FILE = 1;
   
   private void createFile(Uri pickerInitialUri) {
       Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
       intent.addCategory(Intent.CATEGORY_OPENABLE);
       intent.setType("application/pdf");
       intent.putExtra(Intent.EXTRA_TITLE, "invoice.pdf");
   
       // Optionally, specify a URI for the directory that should be opened in
       // the system file picker when your app creates the document.
       intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, pickerInitialUri);
   
       startActivityForResult(intent, CREATE_FILE);
   }
   ```
   
   You can then access external storage
   
   > 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**. 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 create, open, or modify.
   
   in https://developer.android.com/training/data-storage/shared/documents-files#java
   
   Maybe I'm missing or misunderstanding something, please correct me if I am.


-- 
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.

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] jfoclpf edited a comment on issue #426: Storage updates in Android 11

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


   > i wanna save a file, not share a file
   
   You can save a file but you have to use the application directories, which are not accessible to the user, you can use `cordova.file.applicationStorageDirectory` which is read/write.
   
   If you want to save a file for the user to later open (for example a pdf), you have to use `cordova.file.externalRootDirectory`. And right now, on Android 11+ you can't, unless you use the workaround I mentioned. 
   


-- 
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.

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] HarelM commented on issue #426: Storage updates in Android 11

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


   Seems like the fix that was merge #417 in order to solve #408 will no longer work for android 11 (API level 30).
   I'm not entirely sure I understand what needs to be done in android in order to get access to the file system, something like opening a file picker in order to get write permissions to a folder?
   I'd love to help progress this, maybe send a PR if someone can guide me to the relevant place in the code and define the appropriate solution...


----------------------------------------------------------------
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.

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] jfoclpf edited a comment on issue #426: Storage updates in Android 11

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


   > Please update plugin to use MediaStore APIs too, and remove flag "requestLegacyExternalStorage" or make this flag optional
   
   If you want to opt out that flag simply install this plugin from npm and not github 
   
   ```
   cordova plugin add cordova-plugin-file
   ```
   
   But then it it won't work an Android 10+. If you just want to save a file, a temporary workaround is to use the share plugin and then the user saves the file wherever they want. I got this tip from @HarelM and it works nicely on Android 11.


-- 
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.

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] snr-lab commented on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
snr-lab commented on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-767302442


   Adding android:requestLegacyExternalStorage="true" is throwing AAPT: error: attribute android:requestLegacyExternalStorage not found. Because cordova 9.x.x is building with SDK-28 even i mention targetSdkVersion as 29. Is there any workaround for that?


----------------------------------------------------------------
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.

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] JoshuaEGonzalezRuiz commented on issue #426: Storage updates in Android 11

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


   Hello, I was facing a similar problem, when I needed to read a file from the storage of an Android device, the plugin returns null in the contents of the file.
   
   The reason for this is the "partial" permission implemented in Android 11, although the user gives the storage permission this always stays in "only multimedia content".
   
   So what I did was send the user to the settings section of the app and tell them to change the storage permission to "allow access to all files".
   And with that change I was already able to read the files in any directory on the device on Android 11.
   
   Note: 
   You need to implement this in your config.xml for the storage permission to work well on Android 11
               <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
   
   I hope and this will help you.


-- 
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.

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] darnok333 commented on issue #426: Storage updates in Android 11

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


   Hello,
   I just want to share a solution I found to my problem as it's related to this thread.
   
   
   **Problem with SDK 30 :**
   Out team used the path externalApplicationStorageDirectory to store some assets of the application, wich are downloaded the first time the user connect to the application.
   But we weren't able to access those files, and got an ACCESS_DENIED error.
   
   
   **Solution :**
   I made a little modification in CordovaActivity.java in init() function
   
   `protected void init() {
       appView = makeWebView();
       createViews();
       if (!appView.isInitialized()) {
           appView.init(cordovaInterface, pluginEntries, preferences);
       }
     
       /********** MODIFICATION SDK 30 **********/
           WebView webView = (SystemWebView)(appView.getEngine().getView());
           WebSettings webSettings = webView.getSettings();
           webSettings.setAllowFileAccess(true);
       /**********************************/
     
       cordovaInterface.onCordovaInit(appView.getPluginManager());
     
       // Wire the hardware volume controls to control media if desired.
       String volumePref = preferences.getString("DefaultVolumeStream", "");
       if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) {
           setVolumeControlStream(AudioManager.STREAM_MUSIC);
       }
    }`
   
   
   you also need to add these import :
   
   import android.webkit.WebView;
   import android.webkit.WebSettings;
   import org.apache.cordova.engine.SystemWebView;
   
   
   Hope this can help some of you :)
   


-- 
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] erisu commented on issue #426: Storage updates in Android 11

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


   > Hello,
   > I just want to share a solution I found to my problem as it's related to this thread.
   > 
   > **Problem with SDK 30 :**
   > Out team used the path externalApplicationStorageDirectory to store some assets of the application, wich are downloaded the first time the user connect to the application.
   > But we weren't able to access those files, and got an ACCESS_DENIED error.
   > 
   > **Solution :**
   > I made a little modification in CordovaActivity.java in init() function
   > 
   > ```
   > protected void init() {
   >     appView = makeWebView();
   >     createViews();
   >     if (!appView.isInitialized()) {
   >         appView.init(cordovaInterface, pluginEntries, preferences);
   >     }
   >   
   >     /********** MODIFICATION SDK 30 **********/
   >         WebView webView = (SystemWebView)(appView.getEngine().getView());
   >         WebSettings webSettings = webView.getSettings();
   >         webSettings.setAllowFileAccess(true);
   >     /**********************************/
   >   
   >     cordovaInterface.onCordovaInit(appView.getPluginManager());
   >   
   >     // Wire the hardware volume controls to control media if desired.
   >     String volumePref = preferences.getString("DefaultVolumeStream", "");
   >     if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) {
   >         setVolumeControlStream(AudioManager.STREAM_MUSIC);
   >     }
   >  }
   > ```
   > 
   > you also need to add these import :
   > 
   > ```
   > import android.webkit.WebView;
   > import android.webkit.WebSettings;
   > import org.apache.cordova.engine.SystemWebView;
   > ```
   > 
   > Hope this can help some of you :)
   
   I also want to include what Google says about setting `setAllowFileAccess` to `true`, for informational purposes:
   
   > **`setAllowFileAccess`**
   >
   > Enables or disables file access within WebView. Note that this enables or disables file system access only. Assets and resources are still accessible using `file:///android_asset` and `file:///android_res`.
   >
   > **Note:** Apps should not open **file://** URLs from any external source in WebView, don't enable this if your app accepts arbitrary URLs from external sources. It's recommended to always use androidx.webkit.WebViewAssetLoader to access files including assets and resources over **http(s)://** schemes, instead of **file://** URLs. To prevent possible security issues targeting **Build.VERSION_CODES.Q** and earlier, you should explicitly set this value to **false**.


-- 
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] israeltrejo commented on issue #426: Storage updates in Android 11

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


   > > You're right, it is necessary set API Level to 30 for Play Store but I forced the API Level to 30 testing again in Android 8, 9, 10 and 11 and everything worked fine.
   > 
   > When running your tests, did you uninstall the app and its data from your device first?
   > Should test the clean install use case, where a user has never had the app installed before.
   
   Sure, I cleaned the data and uninstall the application before test in each Android version.


-- 
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] erisu commented on issue #426: Storage updates in Android 11

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


   > You're right, it is necessary set API Level to 30 for Play Store but I forced the API Level to 30 testing again in Android 8, 9, 10 and 11 and everything worked fine.
   
   When running your tests, did you uninstall the app and its data from your device first?
   Should test the clean install use case, where a user has never had the app installed before.


-- 
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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   @joshuaokpako that's strange, normally you shouldn't be able to write to `cordova.file.externalRootDirectory + 'Download/'` without the `android:requestLegacyExternalStorage` to true (check the [answer](https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-756757287) from @breautek ) after API 29. Are you using the dev version of this file plugin (i.e. fetched from github)?


-- 
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.

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] olsbg commented on issue #426: Storage updates in Android 11

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


   Adding ' android:requestLegacyExternalStorage="true"' to AndroidManifest.xml solves the problem.
   
   Read more at https://developer.android.com/training/data-storage/use-cases.


----------------------------------------------------------------
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.

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 #426: Storage updates in Android 11

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


   I would like to invite people to try out my fork and give it a test: https://github.com/breautek/cordova-plugin-file/tree/feat/api30
   
   My fork removes the `requestLegacyExternalFlag` which means it should work on both API 29 and API 30+. It ensures that it prompts for the proper permission in read/write external storage.
   
   Here are some highlight changes:
   
   - It's possible that you've already granted or denied external storage permissions, in which case it may just work or it may not work. If you're getting a file not found kind of errors, or file listings are simply empty when you expect there to be content, that probably means you're lacking permissions. Android does not tell us that a file exists but you lack permissions to view; it just gives a file not found error. I assume this is for privacy reasons.
   
   - You can use `adb shell pm reset-permissions` to reset your permissions on **all** apps back to a state of "not requested", so that you can test as if the user is running your app for the first time.
   
   - `externalRootDirectory` is readable, but not writable. You cannot create directories or files inside this directory anymore.
   
   - I used https://github.com/breautek/cordova-file-api30-test-app as a test app. If something is not working right for you on my fork, feel free to make a pull request and add a test case.
   
   - I've seen Google is cracking down, requiring external use via `READ_EXTERNAL_STORAGE/WRITE_EXTERNAL_STORAGE`; in order to use these permissions (and this plugin for accessing external storage) you will need to give justification. You'll going to have to evaluate if your app **needs** external storage access, and if not, then start migrating to internal storage. As a result of this, I'm planning on making this plugin add the external storage permissions as a configurable option.
   
   - This plugin is currently not compatible with `cordova-android@10/nightly`. So please only test using `cordova-android@9.1`


-- 
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.

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] anshuman61 commented on issue #426: Storage updates in Android 11

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


   > 
   > 
   > > I've read through this entire thread (trying to follow as much as I can), the Google docs on scoped storage, and other issues and stackoverflow posts and I'm still not 100% sure that this issue applies to me, so if anyone can tell me I'd really appreciate it...
   > > For a feature I'm working on (involving opening a video, overlaying text on it with canvas, and capturing the output) I need the video and page to be same origin. So I've tried to use API30 and cordova-android@10.0.1 for the WebViewAssetLoader functionality to serve my app from https://localhost.
   > > The problem I have is that after updating (from API29 / cordova-android@9.1), when I select a video from the photo library, using previously working code like this:
   > > ```
   > >           navigator.camera.getPicture(
   > >             file => {
   > >               file = file.indexOf('file://') === 0 ? file : 'file://' + file
   > >               window.resolveLocalFileSystemURL(file, (fileEntry) => {
   > >                 this.video = fileEntry.toInternalURL() // Vue.js data property that populates video src
   > >               })
   > >             },
   > > 
   > >             () => {},
   > > 
   > >             {
   > >               destinationType: Camera.DestinationType.FILE_URI,
   > >               sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
   > >               mediaType: Camera.MediaType.VIDEO
   > >             }
   > >           )
   > >         }
   > > ```
   > > 
   > > 
   > >     
   > >       
   > >     
   > > 
   > >       
   > >     
   > > 
   > >     
   > >   
   > > ... I get an error like this in the console:
   > > `GET cdvfile://localhost/sdcard/DCIM/Camera/VID_20210802_200106.mp4 net::ERR_UNKNOWN_URL_SCHEME`
   > > If I go back to API29 / cordova-android@9.1 it works fine again.
   > > Where I'm not sure if this is the same issue is from comments like this one by @HarelM [#426 (comment)](https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-751977160) :
   > > > @Vatsov Are you reading a file a user selects? If so I don't think there's an issue that is related to Android 11, or at least I hope not as you open the file picker and this should be OK even in Android 11 as far as I know.
   > > 
   > > 
   > > ...and things that I read in google's docs that seem to suggest that reading the users photo/video library is treated differently to accessing other types of file.
   > > Regardless, I've still tried adding the MANAGE_EXTERNAL_STORAGE permission, but that hasn't seemed to have any effect.
   > > So can anyone tell me if this is the same issue? Or is it a different one caused by the upgrade to API30 and/or cordova-android@10.0.1 ?
   > > To be honest I'm feeling a little out of my depth here and would very much like to get back to my cosy javascript safe place! :)
   > > Thanks in advance for any help or suggestions!
   > > I dont try this but i think you can solve your issue using this as suggest [here](https://cordova.apache.org/announcements/2021/07/20/cordova-android-10.0.0.html)
   > > `<preference name="AndroidInsecureFileModeEnabled" value="true" />`
   
   
   Is your Application has File permissions enabled ? Check Android Manifest for these three
   
   `<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>`
   
   if not add these in your `AndroidManifest.xml` . Try to build with these. if problem exists reply me under same thread.


-- 
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] victorvhpg commented on issue #426: Storage updates in Android 11

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


   > Right now on Android 11 you can't
   > […](#)
   
   I know that. This a big problem


-- 
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.

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] jfoclpf edited a comment on issue #426: Storage updates in Android 11

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


   > i wanna save a file, not share a file
   
   You can save a file but you have to use the application directories, which are not accessible to the user, you can use `cordova.file.applicationStorageDirectory`
   
   If you want to save a file for the user to later open (for example a pdf), you have to use `cordova.file.externalRootDirectory`. And right now, on Android 11+ you can't, unless you use the workaround I mentioned. 
   


-- 
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.

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] Topiya commented on issue #426: Storage updates in Android 11

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


   ![Inkedandroid-studio_LI](https://user-images.githubusercontent.com/26486272/142415034-372cf09b-df7d-4c07-b023-388db90f04c6.jpg)
   
   
   I have already added sdk as 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] hanslbua commented on issue #426: Storage updates in Android 11

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


   > `externalDataDirectory`
   
   can you be more specific? can you show me your code?


-- 
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] savitabangera removed a comment on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
savitabangera removed a comment on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-996521386


   > #please let me know I'm also facing same issue for android 11 device (Cordova android@10 ). code :
   > 
   > window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory, function(dir) { dir.getFile("test.pdf", {create:true}, function(file) { file.createWriter(function(fileWriter) { fileWriter.write("byteArrays data"); alert('Message', 'File Downloaded Successfully'); }, function(){ alert('Error!', "Unable to save the file"); }); },function(e){ alert('Error!', e); }); },function(e){ console.log(e); });
   > 
   > https://stackoverflow.com/questions/70110433/cordova-file-externalrootdirectory-not-working-in-android-11-devices
   
   Have you got a solution to this @Maheshvy 


-- 
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] siddharthaPatil commented on issue #426: Storage updates in Android 11

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


   
   
   
   > we are facing a similar issue where existing cordova implementation to read a file from downloads folder is working but not in android 11. Have tried all possible changes suggested to use fileentry object to get reference and then copy to a location where application has access to but read itself is failing. Cordova version used is 9.x and cordova-file-plugin has been used to read file. Required feature is to allow user to select a file from device and upload it. Upload to server is in base64 format. Kindly advise
   > 
   > @alex-steinberg - can you please share your code snippet and clarify whether you are using cordova 9 or cordova 10?
   
   @alex-steinberg - We have set targetSdkVersion to 30 in config.xml file and created build using platform 9.1.0.
   
   Below code works fine in lower android version (till android 10). In android 11 while reading a **pdf file** from download loaction, we get error as **GET file:///storage/emulated/0/Download/Test.pdf net::ERR_ACCESS_DENIED**
   
   this.fileChooser.open()
       .then(uri => {
         let fileName = null;
         let fileExtension = null;
         let fileType = null;
         let isvalid = true;
         this.filePath.resolveNativePath(uri)
             .then(filePath => {
               return this.base64EncodeFile(filePath);
             }).then((base64Data: any)=>{ 
                console.log(base64Data);
             })
         .catch(err => console.log(err));
       })
       .catch(e => console.log(e));
     }
     
     base64EncodeFile(src){
       return new Promise((resolve, reject) => {
         let xhr = new XMLHttpRequest();
         xhr.onload = function () {
           let reader = new FileReader();
           reader.onloadend = function () {
             let result = {
               base64: reader.result,
               size: xhr.response.size,
               type: xhr.response.type
             }
             resolve(result);
           }
           reader.readAsDataURL(xhr.response);
         };
         xhr.open('GET', src);
         xhr.responseType = 'blob';
         xhr.send();
       });
     }
   
   We have also tried below code 
    
   To copy from download folder to internal storage. It gives **{"code":1,"message":"NOT_FOUND_ERR"}** error
   
   pathsrc : file:///storage/emulated/0/Download/Test.pdf
   
   fileName : Test.pdf
   
    this.file.copyFile(pathsrc, fileName, this.file.dataDirectory, fileName).
               then((result) => { console.log('file copied :' + result);
               }).catch(err => console.log("copied err "+ JSON.stringify(err)));;
   
   Below code is using copyTo method, it gives error as **FileError {code: 1}**
   
   window.resolveLocalFileSystemURL(pathsrc, function (fileSystem) {
               fileSystem.getFile(fileName, {
                 create: false, // try true first to make sure that there are no other problems around
                 exclusive: false
               }, function (fileEntry) {
                 window.resolveLocalFileSystemURL(window.cordova.file.externalDataDirectory , function (newFileEntry) {      
                   fileEntry.copyTo(newFileEntry, fileName, function (result) {
                     console.log("save successfully:", result);
                   }, function (err) {
                     console.log("err-fileEntry.copyTo: ",err);
                   });
                 }, function (err) {
                   console.log("err-window.resolveLocalFileSystemURL: ",err);
                 });
               }, function (err) {
                 console.log("err-fileSystem.getFile: ",err);
               });
             }, function (err) {
               console.log("err-resolveLocalFileSystemURL: ",err);
             });
   


-- 
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 edited a comment on issue #426: Storage updates in Android 11

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






-- 
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] Topiya edited a comment on issue #426: Storage updates in Android 11

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


   @breautek I have added _AndroidInsecureFileModeEnabled_ preference in config.xml but it is not woking for me.


-- 
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] Topiya commented on issue #426: Storage updates in Android 11

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


   I have added AndroidInsecureFileModeEnabled in config.xml but it is not woking for me.


-- 
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] Maheshvy edited a comment on issue #426: Storage updates in Android 11

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


   #please let me know I'm also facing same issue for android 11 device (Cordova android@10 ).
   code :
   
   window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory, function(dir) {
       dir.getFile("test.pdf", {create:true}, function(file) {
           file.createWriter(function(fileWriter) {
           fileWriter.write("byteArrays data");
               alert('Message', 'File Downloaded Successfully');
           }, function(){
               alert('Error!', "Unable to save the file");
           });
       },function(e){
           alert('Error!', e);
       });
   },function(e){
       console.log(e);
   });
   
   **I tried with below code in Androidmainfest file**
   
   > - <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
   > - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
   > - <uses-permission android:name="android.permission.ACTION_MANAGE_STORAGE" />
   > - <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
   > - 
   > 
   
   **Config.xml file**
   
   > 
   > - <preference name="AndroidInsecureFileModeEnabled" value="true" />
   > - <preference name="AndroidPersistentFileLocation" value="Compatibility" />
   > - 
   


-- 
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] jfoclpf edited a comment on issue #426: Storage updates in Android 11

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


   @breautek please highlight your comment about the test fork you created, because people are not reading it since the thread is becoming too long.
   
   Newcomers: test the following fork because it was made to overcome all the problems related with storage on Android 11 and beyond
   
   ```
   cordova plugin add https://github.com/breautek/cordova-plugin-file/tree/feat/api30
   ```
   
   and downgrade to cordova 9.1 if necessary (latest is 10)
   ```
   npm i -g cordova-android@9.1
   ```
   
   More info here: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-830841544


-- 
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] HarelM commented on issue #426: Storage updates in Android 11

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


   Users can install xiaomi file manager for example and share a file with that app or simply share with mail, messaging, Facebook, drive etc. The idea is that they can choose what to do with the file instead of the app deciding on an arbitrary location they should "guess".


-- 
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.

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] aphyl30 commented on issue #426: Storage updates in Android 11

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


   Hello, I confirm that it works with sdk 29.0.3.
   I am writing an application that saves files that come either from a web server (downloaded) or created by my application. 
   I'm using sdk 30 and it works for downloaded files with "cordova-plugin-file-transfer" but not locally with "cordova-plugin-file"
   Can someone explain me the difference between the two?
   Thanks


-- 
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.

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] jfoclpf edited a comment on issue #426: Storage updates in Android 11

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


   @breautek please highlight your comment about the test fork you created, because people are not reading it since the thread is becoming too long.
   
   Newcomers: test the following fork 
   
   ```
   cordova plugin add https://github.com/breautek/cordova-plugin-file/tree/feat/api30
   ```
   
   More info here: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-830841544


-- 
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] smartyw commented on issue #426: Storage updates in Android 11

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


   FYI 
   
   window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory + "/Download" used to work but now fails with Code 1 on Android 10 both without specifying  android:requestLegacyExternalStorage="true" and with. I can't test on Android 11.
   
   It would be really useful to know if there's a plan for the maintainers to create a new release which makes the plugin work with Android 10 and 11 without the need to manually tweak files like the manifest. Hope there is. This is a really useful plugin.
   
   Thanks


----------------------------------------------------------------
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.

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] victorvhpg edited a comment on issue #426: Storage updates in Android 11

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


   > I am using ionic 4 and I faced the same issue so I tried the ionic 4 version of resolveDirectoryUrl(cordova.file.externalRootDirectory, function (dirEntry) {)) and on success function I used dirEntry.getDirectory ('Download'... and I can create folders and save files to the Download folders on android 11 without adding android:requestLegacyExternalStorage="true". Here is the code for ionic 4. I have also tried to convert it to the normal web version.
   > 
   > ```
   > createDirectory(rootDir) {
   >     return new Promise((res, rej) => {
   >       this.file.resolveDirectoryUrl(rootDir).then((rootDirEntry)=>{
   >         
   >         rootDirEntry.getDirectory('Download', { create: false, exclusive:false},  (dirEntry) =>{
   >           dirEntry.getDirectory('updates', { create: true, exclusive:false}, (subDirEntry) =>{
   >             this.updateDir = subDirEntry;
   >             this.appDir = dirEntry;
   >             res(this.updateDir)
   >           }, (err)=> {
   >             this.onErrorGetDir(rootDir+'Download/','updates');
   >             rej(err)
   >           })
   >         }, (err)=> {
   >           this.onErrorGetDir(rootDir,'Download')
   >           rej(err)
   >         })
   >       })
   >       
   >     })
   >   }
   > ```
   > 
   > and the normal web version. Note that I have only tested the ionic 4 version of this code.
   > 
   > ```
   > function createDirectory(rootDir /*cordova.file.externalRootDirectory*/) {
   >     window.resolveDirectoryURL(rootDir, function (rootDirEntry) {
   >       dirEntry.getDirectory('Download', { create: false, exclusive:false}, function (dirEntry) {
   >         dirEntry.getDirectory('updates', { create: true, exclusive:false}, function (subDirEntry) {
   >             /* delete a file or donwload a file using cordova-plugin-advanced-http.
   >                 I tested mine using cordova-plugin-advanced-http to download a file to this folder */
   >             createFile(subDirEntry, "fileInNewSubDir.txt");
   > 
   >         }, onErrorGetDir);
   >       }, onErrorGetDir);
   >     })
   >   }
   > ```
   > 
   > This doesn't allow you to write or read from the root directory but works with the download directory and probably other sub directories in the root directory.
   > You will need READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions.
   
   This only work for CREATE files. 
   i can't delete/update a file inside 'Download' folder  without flag 'requestLegacyExternalStorage'  
   Android 11 sdk 30+


-- 
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.

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] victorvhpg commented on issue #426: Storage updates in Android 11

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


   i wanna save a file, not share a file
   
   
   > > Please update plugin to use MediaStore APIs too, and remove flag "requestLegacyExternalStorage" or make this flag optional
   > 
   > If you want to opt out that flag simply install this plugin from npm and not github
   > 
   > ```
   > cordova plugin add cordova-plugin-file
   > ```
   > 
   > But then it it won't work an Android 10+. If you just want to save a file, a temporary workaround is to use the `cordova-plugin-x-socialsharing` and then the user saves the file wherever they want. I got this tip from @HarelM and it works nicely on Android 11.
   
   


-- 
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.

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 #426: Storage updates in Android 11

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


   > @breautek does this plugin request `MANAGE_EXTERNAL_STORAGE`, that is, does it request "Use of All files access permission"? This last sentence is very alarming: "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."
   > 
   > Do you know how can we request use of just one single public directory, for example, the Download directory?
   > 
   > Is there any plugin or means to interact with the [Android Storage Access Framework](https://developer.android.com/guide/topics/providers/document-provider)?
   
   This plugin does not use `MANAGE_EXTERNAL_STORAGE`. It was something I suggested people to use as a workaround in the past before Google made that announcement. Obviously unless if you're building a file manager type of app, it will be hard justifying the usage of `MANAGE_EXTERNAL_STORAGE` permission and therefore won't be recommended for most apps.
   
   I think the single largest challenge with this plugin is how generic access the file plugin is **suppose** to be, and how do we translate file paths to a specific container type (such as Audio, Video, Pictures, Documents, etc), using the appropriate MediaStore APIs. Based on my experience, relying on mime type information inferred by file extension is not really reliable.
   
   Someone will need to do the research, but it might not be possible to use this plugin for external storage anymore, or it may be more efficient to have a new plugin that uses the MediaStore APIs with a cleaner API. like `getAudioList()`, `getDownloadList()`, etc...


-- 
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.

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] chrisjdev commented on issue #426: Storage updates in Android 11

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


   This is quite a thread. I was looking at it trying to figure out why I couldn't read a file after the user selects it from a system file picker. My issue is specifically for targeting API level 30, and my application was attempting to resolve a given URL to a path on the phone, then use a FileInputStream to read the file and write it into a my applications data. The solution to this problem is to call something like context.getContentResolver().openInputStream(uri) to read the file instead. I'm still working out how to connect everything, because right now cordova-android@10, cordova-plugin-filechooser, cordova-plugin-filepath, and cordova-plugin-file are all in use. Just putting this out there, even though it won't help anyone trying to figure out why they can't write files with scoped storage.


-- 
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] joshuaokpako commented on issue #426: Storage updates in Android 11

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


   I believe this is the reason why the code above will work on android 11 https://developer.android.com/about/versions/11/privacy/storage#media-direct-file-native


-- 
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.

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] alex-steinberg edited a comment on issue #426: Storage updates in Android 11

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


   > Does anyone has a solution for the problem with SDKVersion 30?
   
   I don't but I can confirm that Capacitor's [Filesystem](https://capacitorjs.com/docs/apis/filesystem) plugin works great and uses all the new Android APIs under the hood i.e. you get a `content://` URL that you can actually use when storing files.
   
   The ground seems to be shrinking beneath Cordova's feet at an accelerating rate and there's no better time to migrate to Capacitor than now. It's really stable, is a pleasure to use and the migration should be fairly painless.


-- 
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] Yura13 commented on issue #426: Storage updates in Android 11

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


   I use `externalDataDirectory` instead of  `externalRootDirectory`.


-- 
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] hanslbua commented on issue #426: Storage updates in Android 11

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


   With Android 10 save to persistant has worked but i get this error:
   
   `Not allowed to load local resource: file:///storage/emulated/0/app_media/1637263763703.jpg`
   
   Not allowed sounds for me like a permission problem. Has someone else the same problem? How can i fix this?


-- 
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] Topiya removed a comment on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
Topiya removed a comment on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-973908997


   If I add cordova-android 10.1.0 then only it shows Android target: android-30 while add platform.
   
   PS D:\Project> ionic cordova platform add android@10.1.0
   > cordova.cmd platform add android@10.1.0
   Using cordova-fetch for cordova-android@10.1.0
   Adding android project...
   Creating Cordova project for the Android platform:
           Path: platforms\android
           Package: test.test
           Name: test
           Activity: MainActivity
           Android target: android-30


-- 
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] Maheshvy edited a comment on issue #426: Storage updates in Android 11

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


   #please let me know I'm also facing same issue for android 11 device (Cordova android@10 ).
   code :
   
   window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory, function(dir) {
       dir.getFile("test.pdf", {create:true}, function(file) {
           file.createWriter(function(fileWriter) {
           fileWriter.write("byteArrays data");
               alert('Message', 'File Downloaded Successfully');
           }, function(){
               alert('Error!', "Unable to save the file");
           });
       },function(e){
           alert('Error!', e);
       });
   },function(e){
       console.log(e);
   });
   
   **I tried with below code in Androidmainfest file**
   
   - <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
   - <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
   - <uses-permission android:name="android.permission.ACTION_MANAGE_STORAGE" />
   - <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
   - 
   
   **Config.xml file**
   
   - <preference name="AndroidInsecureFileModeEnabled" value="true" />
   - <preference name="AndroidPersistentFileLocation" value="Compatibility" />
   - 
   


-- 
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] savitabangera edited a comment on issue #426: Storage updates in Android 11

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


   we are facing a similar issue where existing cordova implementation to read a file from downloads folder is working but not in android 11. Have tried all possible changes suggested to use fileentry object to get reference and then copy to a location where application has access to but read itself is failing. Cordova version used is 9.x and cordova-file-plugin has been used to read file. Required feature is to allow user to select a file from device and upload it. Upload to server is in base64 format. Kindly advise
   
   @alex-steinberg - can you please share your code snippet and clarify whether you are using cordova 9 or cordova 10?


-- 
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] atebsy edited a comment on issue #426: Storage updates in Android 11

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


   > Chooser
   
   @Vatsov file chooser (this.chooser.getFile()) also returns base64 data, you can convert that into blob, then use the this.file.writeFile() method to save the file into your app directory


-- 
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.

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 #426: Storage updates in Android 11

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


   I would like to invite people to try out my fork and give it a test: https://github.com/breautek/cordova-plugin-file/tree/feat/api30
   
   My fork removes the `requestLegacyExternalFlag` which means it should work on both API 29 and API 30+. It ensures that it prompts for the proper permission in read/write external storage.
   
   **Note:** It's possible that you've already granted or denied external storage permissions, in which case it may just work or it may not work. If you're getting a file not found kind of errors, or file listings are simply empty when you expect there to be content, that probably means you're lacking permissions. Android does not tell us that a file exists but you lack permissions to view; it just gives a file not found error. I assume this is for privacy reasons.
   
   You can use `adb shell pm reset-permissions` to reset your permissions on **all** apps back to a state of "not requested", so that you can test as if the user is running your app for the first time.
   
   I used https://github.com/breautek/cordova-file-api30-test-app as a test app. If something is not working right for you on my fork, feel free to make a pull request and add a test case.
   
   **Another Note:** I've seen Google is cracking down, requiring external use via `READ_EXTERNAL_STORAGE/WRITE_EXTERNAL_STORAGE`; in order to use these permissions (and this plugin for accessing external storage) you will need to give justification. You'll going to have to evaluate if your app **needs** external storage access, and if not, then start migrating to internal storage. As a result of this, I'm planning on making this plugin add the external storage permissions as a configurable option.
   
   **Last Note**: This plugin is currently not compatible with `cordova-android@10/nightly`. So please only test using `cordova-android@9.1`


-- 
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.

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] smartyw commented on issue #426: Storage updates in Android 11

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






----------------------------------------------------------------
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   @Davparis just a question, for what purpose do you need to save and open the files? For the user later to open them or just for the internal storage of the app? If it's the latter you can use `applicationStorageDirectory` which works on every Android version. 


-- 
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   > Please update plugin to use MediaStore APIs too, and remove flag "requestLegacyExternalStorage" or make this flag optional
   
   If you want to opt out that flag simply install this plugin from npm and not github 
   
   ```
   cordova plugin add cordova-plugin-file
   ```
   
   But then it it won't work an Android 10+
   


-- 
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.

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] victorvhpg commented on issue #426: Storage updates in Android 11

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


   @jfoclpf Will this work on Android 11 sdk 30+ ?


-- 
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   Right now on Android 11 you can't
   
   >
   


-- 
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.

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] JoshuaEGonzalezRuiz edited a comment on issue #426: Storage updates in Android 11

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


   Hello, I was facing a similar problem, when I needed to read a file from the storage of an Android device, the plugin returns null in the contents of the file.
   
   The reason for this is the "partial" permission implemented in Android 11, although the user gives the storage permission this always stays in "only multimedia content".
   
   So what I did was send the user to the settings section of the app and tell them to change the storage permission to "allow access to all files".
   And with that change I was already able to read the files in any directory on the device on Android 11.
   
   Note: 
   You need to implement this in your config.xml for the storage permission to work well on Android 11
              ` <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />`
   
   I hope and this will help you.


-- 
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   > If you're app have no real reason to use external storage, then yes, it's probably best to migrate to internal storage. Internal storage is completely sandboxed and your app can read/write to this sandbox with no special permissions.
   
   Does that mean we need to amend this line in `config.xml` ?
   
   ```xml
   <preference name="AndroidExtraFilesystems" value="files,files-external,documents,sdcard,cache,cache-external,assets"/>
   ```
   
   In the case we just use internal storage, how this line should be? Is this ok then?
   
   ```xml
   <preference name="AndroidExtraFilesystems" value="files,cache,assets"/>
   ```


-- 
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.

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] ivanolarocca edited a comment on issue #426: Storage updates in Android 11

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


   > `Starting November 1, 2021, updates to apps and games on Google Play will be required to target Android 11 (API level 30) or higher.`
   > 
   > I have tried to apply a couple of solutions from this thread but it didn't work.
   > 
   > Also, I've tried manually adding the needed permission but 'android.permission.MANAGE_EXTERNAL_STORAGE' don't appear in `AndroidManifest.xml` after I add to config.xml next part:
   > 
   > ```
   >     <config-file file="app/src/main/AndroidManifest.xml" mode="merge" parent="/manifest" xmlns:android="http://schemas.android.com/apk/res/android">
   >       <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
   >     </config-file>
   > ```
   > 
   > package.json
   > 
   > ```
   >     "cordova-android": "^9.1.0",
   >     "cordova-js": "^5.0.0",
   > ```
   
   1. Set "android-targetSdkVersion" to "30"
   2. Update "cordova-version" from 9 to 10
   3. Set the preserveLegacyExternalStorage flag to true to preserve the legacy storage model so that your app can migrate a user's data when they upgrade to the new version of your app that targets Android 11. 
   `<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
               <application android:preserveLegacyExternalStorage="true" />
           </edit-config>` [(source)](https://developer.android.com/training/data-storage/use-cases#if_your_app_targets)
   4. Check latest cordova plugins update and fixs to support new android sdk target and platform [(cordova-android 10 release highlights)](https://cordova.apache.org/announcements/2021/07/20/cordova-android-10.0.0.html)


-- 
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] sachithd commented on issue #426: Storage updates in Android 11

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


   > I addressed the issue where the application could not access a file shared into the application by the user by instead forking cordova-plugin-filepath: [VIAVI-Solutions/cordova-plugin-filepath@a471420](https://github.com/VIAVI-Solutions/cordova-plugin-filepath/commit/a4714209cfbd2bd8eebad902b8f5ef3e34fb8baa)
   
   @chrisjdev Thank you. This is a great workaround for the time being.


-- 
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] pawan-logiciel commented on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
pawan-logiciel commented on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-933363022


    Hey guys any update on this I am not able to upload files from the download folder due to this storage change 
    
    I am getting file input stream in file transfer plugin to show progress other solutions like Media store API and SAF also not working for me 


-- 
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 #426: Storage updates in Android 11

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


   ## What should work
   
   > window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory + "/Download" used to work 
   
   - This should work as is when targeting API 28 (now forbidden by Google Play)
   - This should work when targeting API 29 with the dev version of the plugin (which has the `android:requestLegacyExternalStorage="true"`), alternatively you can use the [<edit-config>](https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#edit-config) to add this flag.
   - This won't work when targeting API 30, as API 30 ignores the `android:requestLegacyExternalStorage` attribute.
   
   It's important to read the [Android Notes](https://developer.android.com/training/data-storage/use-cases#migrate-legacy-storage) before you target API 30. You may need to migrate your files to another folder to maintain access to them when targeting API 30 using the new APIs.
   
   ## Who this will affect
   
   This will affect any app that reads or writes to the external file system (aka the `cordova.file.external*`). If you don't use external file paths, then you probably don't need any changes in your app.
   
   I'll be adding a help wanted label. We don't have a planned solution yet. If a volunteer would take the lead and finding a solution to prepare a PR, I encourage to use our [Dev Mailing List](https://cordova.apache.org/contact/) so that we can discuss requirements and potential solutions.
   
   Useful Links: https://developer.android.com/about/versions/11/privacy/storage


----------------------------------------------------------------
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.

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] alex-steinberg commented on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
alex-steinberg commented on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-961672647


   I don't think anything will work until this plugin uses the new scoped storage APIs. This issue has the label "Help wanted" so if anyone feels like getting their hands dirty with Java that would be great. My time would be better spent migrating to Capacitor.


-- 
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] alexisGandar commented on issue #426: Storage updates in Android 11

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


   > But then it it won't work an Android 10+. If you just want to save a file, a temporary workaround is to use the `cordova-plugin-x-socialsharing` and then the user saves the file wherever they want. I got this tip from @HarelM and it works nicely on Android 11.
   
   @jfoclpf I am not sure that I understood how the workaround works. 
   Using the `cordova-plugin-x-socialsharing` you will ask the user to share the document (on drive, by mail...) so he can get the document. 
   Or is there a way to use this plugin on the 'Files' android app so the user can save the file on his device ?


-- 
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   @breautek please highlight your comment about the test fork you created, because people are not reading it since the thread is becoming too long.
   
   Newcomers: test the following fork 
   
   https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-830841544


-- 
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] Luro91 commented on issue #426: Storage updates in Android 11

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


   > * This plugin is currently not compatible with `cordova-android@10/nightly`. So please only test using `cordova-android@9.1`
   
   Is it compatible with cordova-android@10 now? I tested it and it works for me so far.
   


-- 
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] skmbr commented on issue #426: Storage updates in Android 11

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


   > @skmbr on my side the latest working versions of android and camera plugins are:
   > "cordova-android": "^9.1.0", "cordova-plugin-camera": "^5.0.2",
   > 
   > I dont think that your issue is related with this. Its look like native Java code error from incompatible versions of cordova-android and cordova-plugin-camera. Try to check Java stacktrace in Android Studio logging.
   
   Thanks @sytolk 
   
   The console error I posted is from the javascript console in chrome devtools after building my app in debug mode.
   
   I assumed it wasn't anything to do with the camera plugin as that's returning the correct internal file path.  I thought cordova-plugin-file was responsible for resolveLocalFileSystemURL and cdvfile:// links?
   
   Will I need to wait for cordova-android@10 support in cordova-plugin-camera ?


-- 
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 #426: Storage updates in Android 11

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


   > Seems like the fix that was merge #417 in order to solve #408 will no longer work for android 11 (API level 30).
   
   Yes, you're correct. In API 29, there is a new file system policy. #417 utilised an available flag to request the old file system system, but API 30 will ignore that flag, forcing app developers to implement the new policy model.
   
   To learn about the new android model, you should probably read up on [Scoped Storage](https://developer.android.com/training/data-storage#scoped-storage). I briefly read up on this last weekend and it appears that some apps may require to migrate their data locations depending on where they store data. Scoped storage means just that, you're access to the filesystem is limited to a certain scope. Parts of the file system that you might have had access before may be impossible to access in API 30. **This means app developers should take this time to determine if they need to migrate data.** [Read the android notice](https://developer.android.com/about/versions/11/privacy/storage#migrate-data-for-scoped-storage) for more information on migration. Given the usual pattern, users have probably until August 2021 before Google force API 30 for new apps, and November 2021 before users are forced to use API 30 on existing apps.
   
   The new [MANAGE_EXTERNAL_STORAGE](https://developer.android.com/reference/android/Manifest.permission#MANAGE_EXTERNAL_STORAGE) permission I believe will essentially make the app behave pre API 29 without the legacy storage flag, but will likely be highly scrutinised by Google if the app uses it without a justified reason. This could be an opt in feature by documenting how one can add this permission using    [config-file](https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#config-file) or [edit-config](https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#edit-config). The users must be targeting API 30 in order to use this permission, it isn't available in API 29.
   
   Lastly, getting familiar with the [MediaStore](https://developer.android.com/reference/android/provider/MediaStore) APIs sounds like is quite important, because apps can access some external filesystem storages, for accessing pictures, videos, and other media-related resources.
   
   What needs to be changed exactly in the Apache codebase I'm not so certain myself, I'm not that familiar with the code base.


----------------------------------------------------------------
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.

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] savitabangera removed a comment on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
savitabangera removed a comment on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-995782480


   we are facing a similar issue where existing cordova implementation to read a file from downloads folder is working but not in android 11. Have tried all possible changes suggested to use fileentry object to get reference and then copy to a location where application has access to but read itself is failing. Cordova version used is 9.x and cordova-file-plugin has been used to read file. Required feature is to allow user to select a file from device and upload it. Upload to server is in base64 format. Kindly advise
   
   @alex-steinberg - can you please share your code snippet and clarify whether you are using cordova 9 or cordova 10?


-- 
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] nagdevbharat commented on issue #426: Storage updates in Android 11

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


   I am trying to write file using following code:
   ```javascript
   this.file.checkDir(this.directorypath, 'AppFolder').then((dirExists) => {
           this.file.writeFile(this.downloadDirectory, update_file + '.'+saveExtention, fileData, { replace: true }).then((fileEntry) => {
             let mimeTestType = mimeType;
             let path = fileEntry.nativeURL
             this.openingFile(path, mimeTestType)
             resolve(true)
           }).catch((ex) => {
             resolve(true)
               console.error('Error')
           })
         }, (response) => {
           this.file.createDir(this.directorypath, 'AppFolder', true).then((response) => {
             this.file.writeFile(this.downloadDirectory, update_file + '.'+saveExtention, fileData, { replace: true }).then((fileEntry) => {
               let mimeTestType = mimeType;
               let path = fileEntry.nativeURL
               this.openingFile(path, mimeTestType)
               resolve(true)
             }).catch((ex) => {
               resolve(true)
               console.error('Error')
             })
           })
         })
         });
   ```
   This works till android 10 but not in android 11, it throws error.


-- 
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] alex-steinberg commented on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
alex-steinberg commented on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-1013683264


   This simple [example app](https://github.com/alex-steinberg/android11-cordova-file-issues) should shed some light on some of the issues raised here. At the very least, it would make a good place to continue the conversation around using files on Android 11 Cordova apps since, as has been mentioned, the problems experienced here aren't caused by the `cordova-plugin-file` plugin. cc @siddharthaPatil @danicarla @brunoalex 


-- 
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 #426: Storage updates in Android 11

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


   > > @breautek thanks for the proposed solution.
   > > Does this also fix Writing to external Files like ( /Download ) on SDK 30 ?
   > 
   > It should. I didn't test writing to the `Downloads` directory explicitly, but feel free to augment my test app https://github.com/breautek/cordova-file-api30-test-app/blob/86b1c9135f1e68e62ddc2d874fd82cd933cb9392/www/js/index.js#L173
   
   > thanks for the proposed solution.
   
   My fork is not intended to be a solution, I just want to make sure that my changes are covering API 30 properly in wide range of use cases before I prepare a PR.


-- 
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.

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 #426: Storage updates in Android 11

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


   > This plugin could have a method that would trigger these intents with a file picker,
   
   The goal of this plugin is to be able to programmatically control the file system files, so if the Storage Access Framework requires the use of UI to pick files, I don't think that will be acceptable in this plugin. And if that's the only way to access external files, then it sounds like we'll need a new plugin for accessing the external storage. Although I don't think that's the case, the [MediaStore](https://developer.android.com/training/data-storage/shared/media) has Direct File starting in API 30, which I think could be used, but it is documented that this is an inefficient way (performance wise) of accessing MediaStore/Scoped storage files. Would be great if someone could experiment with this.


-- 
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.

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] anshuman61 commented on issue #426: Storage updates in Android 11

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


   Actually i have the same problem while i upgraded to API 30. I got error code 9 also. As google upgraded its android protocol set for storage we have to use "scoped storage".  
   
   1. In my application i have to capture image, then i have to compress using Javascript image compressors (usually gives better quality than the "`cordova-plugin-camera`" compressors and have more flexibility)  and have to write compressed  files using "`cordova-plugin-file`" to storage.
   
   2. Previously i am using "`LocalFileSystem.PERSISTENT`" and with API 30 i couldn't access that region of my file system due to restrictions imposed.
   
   Example:-
    `window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fs) { 
   console.log('file system open: ' + fs.name);fs.root.getFile("newPersistentFile.txt", { create: true, exclusive: false }, function (fileEntry) {console.log("fileEntry is file?" + fileEntry.isFile.toString());
           // fileEntry.name == 'someFile.txt'
           // fileEntry.fullPath == '/someFile.txt'
           writeFile(fileEntry, null);}, onErrorCreateFile); }, onErrorLoadFs);`
   
   
   
   3. Then i changed  "`LocalFileSystem.PERSISTENT`"  with  "`cordova.file.dataDirectory`" and it worked. Its also logically correct as per the restrictions imposed now a days.  
   
   Example :- 
   
   
    `window.resolveLocalFileSystemURL(cordova.file.dataDirectory, function (dirEntry) {
       console.log('file system open: ' + dirEntry.name);
       var isAppend = true;
       createFile(dirEntry, "fileToAppend.txt", isAppend);
   }, onErrorLoadFs);`
   
   
   
   This example can also be used to create new files, if you provide unique file name each time. Like below.
   
   Example :- 
   
   `
   window.resolveLocalFileSystemURL(cordova.file.dataDirectory, function(fs) {
   createFile(fs, outputfilename);
                           function createFile(dirEntry, fileName, isAppend) {
                               // Creates a new file or returns the file if it already exists (use unique file name each time) .
                               dirEntry.getFile(fileName, { create: true, exclusive: false }, function(fileEntry) {writeFile(fileEntry, result);
                               }, function(err) {
                                   console.log(err);
                               });}function writeFile(fileEntry, dataObj) {
                               // Create a FileWriter object for our FileEntry (log.txt).
                               fileEntry.createWriter(function(fileWriter) {fileWriter.onwriteend = function() {console.log("File written successfully...");console.log(fileEntry); };fileWriter.onerror = function(e) {
                                       console.log("Failed to write file: " + e.toString());
                                   };// If data object is not passed in,
                                   // create a new Blob instead.
                                   if (!dataObj) {
                                       dataObj = new Blob(['some file data'], { type: 'text/plain' });
                                   }fileWriter.write(dataObj);
                               });
                           } }, function(error) { console.log(error); });`
    
   
   Correct me if something i missed. Thank you all. 


-- 
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] victorvhpg commented on issue #426: Storage updates in Android 11

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


   Any update?? 


-- 
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] konnectappdev commented on issue #426: Storage updates in Android 11

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


   > Hello, i found plugin for save image base64 in public directory, using api Media Store. Work in android 10 and 11.
   > I hope and this will help someone.
   > 
   > https://github.com/Heartade/cordova-plugin-android-mediastore
   
   Thanks! 
   This seems to work for us. 
   In our ionic cordova app we want users to be able to download photos and videos stored in our protected app space to their media directory. 
   
   We have extended the repo downloading video files:  
   
   https://github.com/konnectappdev/cordova-plugin-android-mediastore 


-- 
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] jfoclpf edited a comment on issue #426: Storage updates in Android 11

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


   > Please update plugin to use MediaStore APIs too, and remove flag "requestLegacyExternalStorage" or make this flag optional
   
   If you want to opt out that flag simply install this plugin from npm and not github 
   
   ```
   cordova plugin add cordova-plugin-file
   ```
   
   But then it it won't work an Android 10+. If you just want to save a file, a temporary workaround is to use the `cordova-plugin-x-socialsharing` and then the user saves the file wherever they want. I got this tip from @HarelM and it works nicely on Android 11.


-- 
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.

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 #426: Storage updates in Android 11

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


   > I changed the android version in which the application is focused adding this tag in the config.xml:
   > `<preference name="android-targetSdkVersion" value="28" />`
   > And this change allows to save files into the device using on Android 8, Android 9, Android 10 and Android 11.
   > I did tests on Android emulator and physical devices working correctly.
   > 
   > The Android documentation recommends to change the API Level version to avoid the scoped storage feature on Android 10.
   > 
   > You get more information about scoped storage feature here:
   > https://developer.android.com/training/data-storage/use-cases#opt-out-scoped-storage
   > 
   > I hope this information will be helpful.
   
   This isn't a solution to anybody who wants to publish to the Google Play store as they require the target SDK to be set to >= 30.


-- 
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] Carlosps commented on issue #426: Storage updates in Android 11

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


   Same here @jfoclpf. I will paste the text here so that people can find it easier.
   
   Starting May 5th, you must let us know why your app requires broad storage access
   
   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.
   
   There is a [learn more](https://support.google.com/googleplay/android-developer/answer/10467955)


-- 
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.

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] HarelM commented on issue #426: Storage updates in Android 11

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


   For android 10 and 11 that's probably true, but if you need to support 9 in one plugin it's hard...


-- 
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] HarelM commented on issue #426: Storage updates in Android 11

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


   @Vatsov Are you reading a file a user selects? If so I don't think there's an issue that is related to Android 11, or at least I hope not as you open the file picker and this should be OK even in Android 11 as far as I know.
   The other way I solved the file open is by registering my app to open certain file types and allowing the user to share these files with the app.
   https://github.com/IsraelHikingMap/Site/blob/4e479a5a92051ae5ec84136ca8c20547a4d11f26/IsraelHiking.Web/config.xml#L45
   And:
   https://github.com/IsraelHikingMap/Site/blob/4e479a5a92051ae5ec84136ca8c20547a4d11f26/IsraelHiking.Web/sources/application/services/open-with.service.ts#L85
   Hope that helps... :-) 


----------------------------------------------------------------
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.

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] victorvhpg commented on issue #426: Storage updates in Android 11

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


   Me
   
   > > i wanna save a file, not share a file
   > 
   > You can save a file but you have to use the application directories, which are not accessible to the user, you can use `cordova.file.applicationStorageDirectory` which is read/write.
   > 
   > If you want to save a file for the user to later open (for example a pdf), you have to use `cordova.file.externalRootDirectory`. And right now, on Android 11+ you can't, unless you use the workaround I mentioned.
   
   I need save to a shared folder. (Create/delete)


-- 
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.

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] HarelM commented on issue #426: Storage updates in Android 11

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


   Seems like opening a file in android 11 doesn't work. It does work in android 10. I'm not using any code but simply input with type=file to pick a file.
   If anyone has a solution please let me know, I'll see if I can send a PR once I get to trying and fixing it...


----------------------------------------------------------------
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.

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 #426: Storage updates in Android 11

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


   ## What should work
   
   > window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory + "/Download" used to work 
   
   - This should work as is when targeting API 28 (now forbidden by Google Play)
   - This should work when targeting API 29 with the dev version of the plugin (which has the `android:requestLegacyExternalStorage="true"`), alternatively you can use the [edit-config](https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#edit-config) to add this flag.
   - This won't work when targeting API 30, as API 30 ignores the `android:requestLegacyExternalStorage` attribute.
   
   It's important to read the [Android Notes](https://developer.android.com/training/data-storage/use-cases#migrate-legacy-storage) before you target API 30. You may need to migrate your files to another folder to maintain access to them when targeting API 30 using the new APIs.
   
   ## Who this will affect
   
   This will affect any app that reads or writes to the external file system (aka the `cordova.file.external*`). If you don't use external file paths, then you probably don't need any changes in your app.
   
   I'll be adding a help wanted label. We don't have a planned solution yet. If a volunteer would take the lead and finding a solution to prepare a PR, I encourage to use our [Dev Mailing List](https://cordova.apache.org/contact/) so that we can discuss requirements and potential solutions.
   
   Useful Links: https://developer.android.com/about/versions/11/privacy/storage


----------------------------------------------------------------
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.

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] victorvhpg edited a comment on issue #426: Storage updates in Android 11

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


   Me
   
   > > i wanna save a file, not share a file 
   > 
   > You can save a file but you have to use the application directories, which are not accessible to the user, you can use `cordova.file.applicationStorageDirectory` which is read/write.
   > 
   > If you want to save a file for the user to later open (for example a pdf), you have to use `cordova.file.externalRootDirectory`. And right now, on Android 11+ you can't, unless you use the workaround I mentioned.
   
   I need save to a shared folder like cordova.file.externalRootDirectory (write/reais)


-- 
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.

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] sytolk edited a comment on issue #426: Storage updates in Android 11

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


   @skmbr on my side the latest working versions of android and camera plugins are:
   "cordova-android": "^9.1.0", "cordova-plugin-camera": "^5.0.2",
   
   I dont think that your issue is related with this. Its look like native Java code error from incompatible versions of cordova-android and cordova-plugin-camera. Try to check Java stacktrace in Android Studio logging.


-- 
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] Topiya commented on issue #426: Storage updates in Android 11

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


   If I add cordova-android 10.1.0 then only it shows Android target: android-30 while add platform.
   
   PS D:\Project> ionic cordova platform add android@10.1.0
   > cordova.cmd platform add android@10.1.0
   Using cordova-fetch for cordova-android@10.1.0
   Adding android project...
   Creating Cordova project for the Android platform:
           Path: platforms\android
           Package: test.test
           Name: test
           Activity: MainActivity
           Android target: android-30


-- 
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] Maheshvy edited a comment on issue #426: Storage updates in Android 11

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


   please let me know I'm also facing same issue for android 11 device (Cordova android@10 ).
   code :
   
   window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory, function(dir) {
       dir.getFile("test.pdf", {create:true}, function(file) {
           file.createWriter(function(fileWriter) {
           fileWriter.write("byteArrays data");
               alert('Message', 'File Downloaded Successfully');
           }, function(){
               alert('Error!', "Unable to save the file");
           });
       },function(e){
           alert('Error!', e);
       });
   },function(e){
       console.log(e);
   });
   
   **I tried with below code in Androidmainfest file**
   
   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.ACTION_MANAGE_STORAGE" />
   <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
   
   **Config.xml file**
   <preference name="AndroidInsecureFileModeEnabled" value="true" />
   <preference name="AndroidPersistentFileLocation" value="Compatibility" />
   
   


-- 
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] interstellerS commented on issue #426: Storage updates in Android 11

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


   @breautek  thanks for the proposed solution.
   
   Does this also fix Writing to external Files like ( /Download ) on SDK 30 ?


-- 
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   > Or is there a way to use this plugin on the 'Files' android app so the user can save the file on his device ?
   
   I recommend my users to simply install [this add-on](https://play.google.com/store/apps/details?id=com.boxhead.android.sharetofilesystem&hl=en_US&gl=US), I'd say it's not even an app, it simply allows you to share to file system


-- 
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.

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] Yura13 commented on issue #426: Storage updates in Android 11

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


   ```Starting November 1, 2021, updates to apps and games on Google Play will be required to target Android 11 (API level 30) or higher.```
   
   I have tried to apply a couple of solutions from this thread but it didn't work.  
   
   Also, I've tried manually adding the needed permission but 'android.permission.MANAGE_EXTERNAL_STORAGE' don't appear in `AndroidManifest.xml` after I add to config.xml next part:
   ```
       <config-file file="app/src/main/AndroidManifest.xml" mode="merge" parent="/manifest" xmlns:android="http://schemas.android.com/apk/res/android">
         <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
       </config-file>
   ```
   
   package.json
   ```
       "cordova-android": "^9.1.0",
       "cordova-js": "^5.0.0",
   ```
   


-- 
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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   received yesterday, Google is pressing on time limits
   
   ![screenshot_4](https://user-images.githubusercontent.com/3984909/114942857-705ce400-9e45-11eb-9ffe-5ee422506d52.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.

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] victorvhpg edited a comment on issue #426: Storage updates in Android 11

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


   > @victorvhpg Google will not remove apps with that flag to true, it will simply ignore that flag on Android 11+. Google will remove indeed apps with `MANAGE_EXTERNAL_STORAGE` permission with no valid reason therefor.
   
   Sorry, you are right, the flag will ignored.
   I dont wanna use 
   `MANAGE_EXTERNAL_STORAGE`  ( all device files)
   Only a public/shared folder like "download" its good for me.
   


-- 
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.

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] victorvhpg commented on issue #426: Storage updates in Android 11

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


   @breautek any update?


-- 
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] skmbr commented on issue #426: Storage updates in Android 11

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


   @krunalsk007 
   > > I dont try this but i think you can solve your issue using this as suggest [here](https://cordova.apache.org/announcements/2021/07/20/cordova-android-10.0.0.html)
   > > `<preference name="AndroidInsecureFileModeEnabled" value="true" />`
   
   No, that puts everything back to using file://
   
   I need https://localhost and WebViewAssetLoader to solve my origin issues.


-- 
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] HarelM commented on issue #426: Storage updates in Android 11

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


   I've recently implanted a small android app which had to save images to a folder/media storage so I might publish my conclusions here once I'm done...


----------------------------------------------------------------
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   Thank you so much @breautek 
   but I really don't know either how come Play Store is complaining about `MANAGE_EXTERNAL_STORAGE` in my cordova app, because my [`config.xml`](https://github.com/jfoclpf/form-for-parking-violation/blob/master/config.xml) does not make any reference to `MANAGE_EXTERNAL_STORAGE`. If my cordova APP has set this `MANAGE_EXTERNAL_STORAGE` where should it be?


-- 
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.

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] victorvhpg edited a comment on issue #426: Storage updates in Android 11

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


   Me
   
   > > i wanna save a file, not share a file
   > 
   > You can save a file but you have to use the application directories, which are not accessible to the user, you can use `cordova.file.applicationStorageDirectory` which is read/write.
   > 
   > If you want to save a file for the user to later open (for example a pdf), you have to use `cordova.file.externalRootDirectory`. And right now, on Android 11+ you can't, unless you use the workaround I mentioned.
   
   I need save to a shared folder. (read/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.

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 #426: Storage updates in Android 11

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


   > Thank you so much @breautek
   > but I really don't know either how come Play Store is complaining about `MANAGE_EXTERNAL_STORAGE` in my cordova app, because my [`config.xml`](https://github.com/jfoclpf/form-for-parking-violation/blob/master/config.xml) does not make any reference to `MANAGE_EXTERNAL_STORAGE`. If my cordova APP has set this `MANAGE_EXTERNAL_STORAGE` where should it be?
   
   Probably in your `<cordova-root>/platforms/android/app/src/main/AndroidManifest.xml`
   
   If you see it there, I'd suggest try removing the platform and re-adding it. Cordova does a good job making sure things gets added to files, but has a hard time cleaning up if configurations gets removed.


-- 
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.

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] hanslbua commented on issue #426: Storage updates in Android 11

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


   Anyone else who had a solution for that without capacitor?


-- 
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] Topiya commented on issue #426: Storage updates in Android 11

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


   > @Topiya Yes. You probably need to change the next lines in config.xml:
   > 
   > ```
   >         <preference name="android-minSdkVersion" value="22" />
   >         <preference name="android-targetSdkVersion" value="30" />
   > ```
   
   @Yura13  I have already added above lines in config.xml. But still getting Android target: android-29


-- 
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] krunalsk007 commented on issue #426: Storage updates in Android 11

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


   > I've read through this entire thread (trying to follow as much as I can), the Google docs on scoped storage, and other issues and stackoverflow posts and I'm still not 100% sure that this issue applies to me, so if anyone can tell me I'd really appreciate it...
   > 
   > For a feature I'm working on (involving opening a video, overlaying text on it with canvas, and capturing the output) I need the video and page to be same origin. So I've tried to use API30 and cordova-android@10.0.1 for the WebViewAssetLoader functionality to serve my app from https://localhost.
   > 
   > The problem I have is that after updating (from API29 / cordova-android@9.1), when I select a video from the photo library, using previously working code like this:
   > 
   > ```
   >           navigator.camera.getPicture(
   >             file => {
   >               file = file.indexOf('file://') === 0 ? file : 'file://' + file
   >               window.resolveLocalFileSystemURL(file, (fileEntry) => {
   >                 this.video = fileEntry.toInternalURL() // Vue.js data property that populates video src
   >               })
   >             },
   > 
   >             () => {},
   > 
   >             {
   >               destinationType: Camera.DestinationType.FILE_URI,
   >               sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
   >               mediaType: Camera.MediaType.VIDEO
   >             }
   >           )
   >         }
   > ```
   > 
   > ... I get an error like this in the console:
   > 
   > `GET cdvfile://localhost/sdcard/DCIM/Camera/VID_20210802_200106.mp4 net::ERR_UNKNOWN_URL_SCHEME`
   > 
   > If I go back to API29 / cordova-android@9.1 it works fine again.
   > 
   > Where I'm not sure if this is the same issue is from comments like this one by @HarelM [#426 (comment)](https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-751977160) :
   > 
   > > @Vatsov Are you reading a file a user selects? If so I don't think there's an issue that is related to Android 11, or at least I hope not as you open the file picker and this should be OK even in Android 11 as far as I know.
   > 
   > ...and things that I read in google's docs that seem to suggest that reading the users photo/video library is treated differently to accessing other types of file.
   > 
   > Regardless, I've still tried adding the MANAGE_EXTERNAL_STORAGE permission, but that hasn't seemed to have any effect.
   > 
   > So can anyone tell me if this is the same issue? Or is it a different one caused by the upgrade to API30 and/or cordova-android@10.0.1 ?
   > 
   > To be honest I'm feeling a little out of my depth here and would very much like to get back to my cosy javascript safe place! :)
   > 
   > Thanks in advance for any help or suggestions!
   I dont try this but i think you can solve your issue using this as suggest [here](https://cordova.apache.org/announcements/2021/07/20/cordova-android-10.0.0.html)
   `<preference name="AndroidInsecureFileModeEnabled" value="true" />` 
   


-- 
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] rmeyers4 edited a comment on issue #426: Storage updates in Android 11

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


   I work on an application that allows users to create directories in `externalRootDirectory` and save various files into these directories (QR codes, log files, csv files, etc). Users expect to be able to copy files off of the tablet when using a Windows computer to explore the tablet file system.
   
   After spending a bunch of time trying to migrate this functionality to allow files to be saved to `externalApplicationStorageDirectory`, I discovered a potentially much simpler solution. From my testing so far, applications using this plugin and opting in to Scoped Storage can still create directories and write files to the `Documents` folder in `externalRootDirectory`.
   
   I tested this on API 29 with Scoped Storage enabled on an Android 11 tablet by going to Developer Options -> App Compatibility Changes -> <my application> and turning on  `FORCE_ENABLED_SCOPED_STORAGE` and
    all of the "Enabled for targetSdkVersion > 29 features" except for `NATIVE_HEAP_POINTER_TAGGING`. I have no idea why this flag prevents files from being created, but luckily it is not (currently) required for apps targeting API 30.
   
   I then targeted API 30 and added the following to `config.xml`:
   ```
     <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
       <application android:allowNativeHeapPointerTagging="false"/>
     </edit-config>
   
   ```
   https://developer.android.com/guide/topics/manifest/application-element#allowNativeHeapPointerTagging
   
   My application seems to function as it did without scoped storage as long as I prefix my paths with `Documents/` when targeting API 29 and API 30.  We will need to train our users to expect files to be in this location, but (so far) this seems much simpler than trying to use app-specific storage.
   
   I hope this helps someone else, or hope someone tells me why I'm wrong!
   


-- 
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] smartyw commented on issue #426: Storage updates in Android 11

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


   @breautek Thanks for the quick response and useful summary. I'll have to think about this :-)


----------------------------------------------------------------
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   @breautek does this plugin request `MANAGE_EXTERNAL_STORAGE`, that is, does it request "Use of All files access  permission"? This last sentence is very alarming: "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."
   
   Do you know how can we request use of just one single public directory, for example, the Download directory?
   
   Is there any plugin or means to interact with the [Android Storage Access Framework](https://developer.android.com/guide/topics/providers/document-provider)?
   


-- 
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.

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] jfoclpf edited a comment on issue #426: Storage updates in Android 11

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


   @HarelM check the [differences](https://github.com/apache/cordova-plugin-file/compare/24dba9f4f9e6cdb17c5e11959df5a5785f1aa6e6..5274cab39e3f96a8682a74ba28663f32611501c8) between the npm latest version 6.0.2 and this github dev version.
   
   The differences in the core code, if I could fully understand, are negligible 
   
   The npm version does not have the flag `requestLegacyExternalStorage` to true, so my advice is to use the npm version, that is what I plan to do
   
   ```
   cordova plugin rm cordova-plugin-file
   cordova plugin add cordova-plugin-file
   ```
   
   That said, I also agree with you that that flag should be set to false. You can find it [here](https://github.com/apache/cordova-plugin-file/blob/master/plugin.xml#L136).
   
   


-- 
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.

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] HarelM commented on issue #426: Storage updates in Android 11

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


   Not yet, but we are talking about two different issues: 
   1. Save to file
   2. Open a file
   
   To summarize my experience:
   1. I have "solved" save to file by using social sharing - both due to security and mainly due to better user experience (IMO of course)
   2. I will be looking into the issue of file open on android 11 soon - see issue https://github.com/IsraelHikingMap/Site/issues/1451 in my repo.
   
   Also I've just seen recently that starting from August/November this year Google is changing the policy to target API level 30 for all new/updated applications so this has to be solved soon from my point of view...


-- 
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   @HarelM do you have any updates on this issue? 
   Is the social sharing plugin the only option yet to save a file in Android 11?


-- 
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.

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] bondulich commented on issue #426: Storage updates in Android 11

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


   Hello, i found plugin for save image base64 in public directory, using api Media Store. Work in android 10 and 11.
   I hope and this will help someone.
   
   https://github.com/Heartade/cordova-plugin-android-mediastore


-- 
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.

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] israeltrejo commented on issue #426: Storage updates in Android 11

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


   > > I changed the android version in which the application is focused adding this tag in the config.xml:
   > > `<preference name="android-targetSdkVersion" value="28" />`
   > > And this change allows to save files into the device using on Android 8, Android 9, Android 10 and Android 11.
   > > I did tests on Android emulator and physical devices working correctly.
   > > The Android documentation recommends to change the API Level version to avoid the scoped storage feature on Android 10.
   > > You get more information about scoped storage feature here:
   > > https://developer.android.com/training/data-storage/use-cases#opt-out-scoped-storage
   > > I hope this information will be helpful.
   > 
   > This isn't a solution to anybody who wants to publish to the Google Play store as they require the target SDK to be set to >= 30.
   
   You're right, it is necessary set API Level to 30 for Play Store but I forced the API Level to 30 testing again in Android 8, 9, 10 and 11 and everything worked fine.
   
   This is the preference tag:
   `<preference name="android-targetSdkVersion" value="30" />`
   
   Also, I tested that an application with this tag could be uploaded to Play Store Console and the file was accepted.


-- 
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] sudeekshachip1003 commented on issue #426: Storage updates in Android 11

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


   > I would like to invite people to try out my fork and give it a test: https://github.com/breautek/cordova-plugin-file/tree/feat/api30
   > 
   > My fork removes the `requestLegacyExternalFlag` which means it should work on both API 29 and API 30+. It ensures that it prompts for the proper permission in read/write external storage.
   > 
   > Here are some highlight changes:
   > 
   > * It's possible that you've already granted or denied external storage permissions, in which case it may just work or it may not work. If you're getting a file not found kind of errors, or file listings are simply empty when you expect there to be content, that probably means you're lacking permissions. Android does not tell us that a file exists but you lack permissions to view; it just gives a file not found error. I assume this is for privacy reasons.
   > * You can use `adb shell pm reset-permissions` to reset your permissions on **all** apps back to a state of "not requested", so that you can test as if the user is running your app for the first time.
   > * `externalRootDirectory` is readable, but not writable. You cannot create directories or files inside this directory anymore.
   > * I used https://github.com/breautek/cordova-file-api30-test-app as a test app. If something is not working right for you on my fork, feel free to make a pull request and add a test case.
   > * I've seen Google is cracking down, requiring external use via `READ_EXTERNAL_STORAGE/WRITE_EXTERNAL_STORAGE`; in order to use these permissions (and this plugin for accessing external storage) you will need to give justification. You'll going to have to evaluate if your app **needs** external storage access, and if not, then start migrating to internal storage. As a result of this, I'm planning on making this plugin add the external storage permissions as a configurable option.
   > * This plugin is currently not compatible with `cordova-android@10/nightly`. So please only test using `cordova-android@9.1`
   
   Im having a use case of reading the files from shared storage which is failing in android 11 currently. I had tried your solution. It asks for the permissions required and requestLegacyExternalFlag is removed. But still unable to read the files. 
   
   As the new apps would need to target SDK 30, any workaround for this issue? Any way to read files from shared storage(Downloads/images..).
   
    Thanks
   
   


-- 
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.

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] victorvhpg commented on issue #426: Storage updates in Android 11

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


   > Hello, i found plugin for save image base64 in public directory, using api Media Store. Work in android 10 and 11.
   > I hope and this will help someone.
   > 
   > https://github.com/Heartade/cordova-plugin-android-mediastore
   @HarelM @breautek 
   Maybe the solution is mediaStore 


-- 
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] snr-lab removed a comment on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
snr-lab removed a comment on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-767274266


   Hi,
   
   I am getting com.android.builder.internal.aapt.v2.Aapt2Exception exception after adding android:requestLegacyExternalStorage="true" using edit config. Any help is appreciated.


----------------------------------------------------------------
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.

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] snr-lab commented on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
snr-lab commented on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-767274266


   Hi,
   
   I am getting com.android.builder.internal.aapt.v2.Aapt2Exception exception after adding android:requestLegacyExternalStorage="true" using edit config. Any help is appreciated.


----------------------------------------------------------------
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.

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] Davparis edited a comment on issue #426: Storage updates in Android 11

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


   Here is my case :
   
   I have an app in production that actually :
   - target API29, with android:requestLegacyExternalStorage="true"
   - and use :
   1) cordova.file.externalRootDirectory 
   2) file path to external card, if the external card exits, via cordova.plugins.diagnostic.getExternalSdCardDetails
   
   According to my tests, with a device using Android 11 (API 30) and android:requestLegacyExternalStorage="false" in AndroidManifest.xml
   <s>- I can read an existing file
   - but can't create a new one</s>
   
   EDIT:
   When i change android:requestLegacyExternalStorage from "false" to "true" :
   - with a simple update of the app, Read and Write are OK
   - when the app is uninstalled, and re-installed, no Read, no Write
   
   To support the changes requested by Google, I'm planning to :
   - check if access to external is actually granted via cordova.plugins.diagnostic.requestExternalStorageAuthorization
   and then :
   - copy user existing files (as far as i can read them) to cordova.file.dataDirectory
   - put a variable in localstorage, so that the app use cordova.file.dataDirectory for the next starts.
   
   If it is a fresh install, I would use only cordova.file.dataDirectory for storing the new files.
   
   But i'm stuck for the access to external card.
   Is there a way to get a path to a folder in external card, even if that path is acceded only by my application ?
   
   What is strange is that the path returned by getExternalSdCardDetails seems to use a sandboxed folder :
   file:///storage/0123-4567/Android/data/com.mycompany.myapp/files/
   


-- 
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.

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] joshuaokpako commented on issue #426: Storage updates in Android 11

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


   @victorvhpg I believe the new android 11 update will only allow you delete files that are created by your app in the Download folder. I haven't tested deleting any other file but I have used the code on ionic 4 to delete files I created in the Download folder.
   
   ```
   delelteFile(dir:DirectoryEntry,name) {
       return new Promise((res, rej) => {
         dir.getFile(name, {create: false}, function (fileEntry) {
             fileEntry.remove( () =>{
               res("deleted")
             }, function (error) {
               rej(error)
             });
         }, function () {
           res("ok")
         });
       })
   
     }
   ```


-- 
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.

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 #426: Storage updates in Android 11

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


   > Will be this backward compatible for API <= 28 also?
   
   Yes, but you still need to use build tools version 29, otherwise the build will fail to recognize `android:requestLegacyExternalStorage`.


----------------------------------------------------------------
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.

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] drogerie21 edited a comment on issue #426: Storage updates in Android 11

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


   > Hello, I was facing a similar problem, when I needed to read a file from the storage of an Android device, the plugin returns null in the contents of the file.
   > 
   > The reason for this is the "partial" permission implemented in Android 11, although the user gives the storage permission this always stays in "only multimedia content".
   > 
   > So what I did was send the user to the settings section of the app and tell them to change the storage permission to "allow access to all files".
   > And with that change I was already able to read the files in any directory on the device on Android 11.
   > 
   > Note:
   > You need to implement this in your config.xml for the storage permission to work well on Android 11
   > ` <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />`
   > 
   > I hope and this will help you.
   
   Unfortunately this is not working for me!
   I try to write  a file from a html input tag. This is working with eg files from the Downloads-Folder. But it is not working with files from google drive. Setting the permission to access all files  ("android.permission.MANAGE_EXTERNAL_STORAGE") does not change this behaviour. I get this error message:
   `DOMException: The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.`


-- 
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] victorvhpg edited a comment on issue #426: Storage updates in Android 11

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


   > I am using ionic 4 and I faced the same issue so I tried the ionic 4 version of resolveDirectoryUrl(cordova.file.externalRootDirectory, function (dirEntry) {)) and on success function I used dirEntry.getDirectory ('Download'... and I can create folders and save files to the Download folders on android 11 without adding android:requestLegacyExternalStorage="true". Here is the code for ionic 4. I have also tried to convert it to the normal web version.
   > 
   > ```
   > createDirectory(rootDir) {
   >     return new Promise((res, rej) => {
   >       this.file.resolveDirectoryUrl(rootDir).then((rootDirEntry)=>{
   >         
   >         rootDirEntry.getDirectory('Download', { create: false, exclusive:false},  (dirEntry) =>{
   >           dirEntry.getDirectory('updates', { create: true, exclusive:false}, (subDirEntry) =>{
   >             this.updateDir = subDirEntry;
   >             this.appDir = dirEntry;
   >             res(this.updateDir)
   >           }, (err)=> {
   >             this.onErrorGetDir(rootDir+'Download/','updates');
   >             rej(err)
   >           })
   >         }, (err)=> {
   >           this.onErrorGetDir(rootDir,'Download')
   >           rej(err)
   >         })
   >       })
   >       
   >     })
   >   }
   > ```
   > 
   > and the normal web version. Note that I have only tested the ionic 4 version of this code.
   > 
   > ```
   > function createDirectory(rootDir /*cordova.file.externalRootDirectory*/) {
   >     window.resolveDirectoryURL(rootDir, function (rootDirEntry) {
   >       dirEntry.getDirectory('Download', { create: false, exclusive:false}, function (dirEntry) {
   >         dirEntry.getDirectory('updates', { create: true, exclusive:false}, function (subDirEntry) {
   >             /* delete a file or donwload a file using cordova-plugin-advanced-http.
   >                 I tested mine using cordova-plugin-advanced-http to download a file to this folder */
   >             createFile(subDirEntry, "fileInNewSubDir.txt");
   > 
   >         }, onErrorGetDir);
   >       }, onErrorGetDir);
   >     })
   >   }
   > ```
   > 
   > This doesn't allow you to write or read from the root directory but works with the download directory and probably other sub directories in the root directory.
   > You will need READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions.
   
   This only work for CREATE files.
   i can't delete/update a file inside 'Download' folder  without flag 'requestLegacyExternalStorage'  


-- 
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.

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] victorvhpg edited a comment on issue #426: Storage updates in Android 11

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


   Me
   
   > > i wanna save a file, not share a file 
   > 
   > You can save a file but you have to use the application directories, which are not accessible to the user, you can use `cordova.file.applicationStorageDirectory` which is read/write.
   > 
   > If you want to save a file for the user to later open (for example a pdf), you have to use `cordova.file.externalRootDirectory`. And right now, on Android 11+ you can't, unless you use the workaround I mentioned.
   
   I need save to a shared folder like cordova.file.externalRootDirectory (write/read) Google will ignore requestLegacyExternalStorage 


-- 
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   > i wanna save a file, not share a file
   
   You can save a file but you have to use the application directories, which are not accessible to the user, you can use `cordova.file.applicationDirectory` or `cordova.file.applicationStorageDirectory`
   
   If you want to save a file for the user to later open (for example a pdf), you have to use `cordova.file.externalRootDirectory`. And right now, on Android 11+ you can't, unless you use the workaround I mentioned. 
   


-- 
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.

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] HarelM commented on issue #426: Storage updates in Android 11

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


   @olsbg this won't work for android 11, it does and will work for android 10.
   I've migrated my entire code that saves file to the external file system to share files that are created in memory to avoid any future limitations...


----------------------------------------------------------------
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.

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] sytolk commented on issue #426: Storage updates in Android 11

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


   @skmbr on my side the latest working versions of android and camera plugins are:
   "cordova-android": "^9.1.0", "cordova-plugin-camera": "^5.0.2",


-- 
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] jfoclpf edited a comment on issue #426: Storage updates in Android 11

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


   @breautek please highlight your comment about the test fork you created, because people are not reading it since the thread is becoming too long.
   
   Newcomers: test the following fork 
   
   ```
   cordova plugin add https://github.com/breautek/cordova-plugin-file/tree/feat/api30
   ```
   
   https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-830841544


-- 
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 #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
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


[GitHub] [cordova-plugin-file] Topiya edited a comment on issue #426: Storage updates in Android 11

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


   @breautek I have added _AndroidInsecureFileModeEnabled_ preference in config.xml but it is not working for me.


-- 
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] Maheshvy commented on issue #426: Storage updates in Android 11

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


   please let me know I'm also facing same issue for android 11 device (Cordova android@10 ).
   code :
   
   window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory, function(dir) {
       dir.getFile("test.pdf", {create:true}, function(file) {
           file.createWriter(function(fileWriter) {
           fileWriter.write("byteArrays data");
               alert('Message', 'File Downloaded Successfully');
           }, function(){
               alert('Error!', "Unable to save the file");
           });
       },function(e){
           alert('Error!', e);
       });
   },function(e){
       console.log(e);
   });
   
   **I tried with below code in Androidmainfest file**
   
   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.ACTION_MANAGE_STORAGE" />
   <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
   
   
   
   **Config.xml file**
   <preference name="AndroidInsecureFileModeEnabled" value="true" />
   <preference name="AndroidPersistentFileLocation" value="Compatibility" />
   
   


-- 
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] Maheshvy edited a comment on issue #426: Storage updates in Android 11

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






-- 
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] alex-steinberg commented on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
alex-steinberg commented on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-961672647


   I don't think anything will work until this plugin uses the new scoped storage APIs. This issue has the label "Help wanted" so if anyone feels like getting their hands dirty with Java that would be great. My time would be better spent migrating to Capacitor.


-- 
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] savitabangera commented on issue #426: Storage updates in Android 11

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


   we are facing a similar issue where existing cordova implementation to read a file from downloads folder is working but not in android 11. Have tried all possible changes suggested to use fileentry object to get reference and then copy to a location where application has access to but read itself is failing. Cordova version used is 9.x and cordova-file-plugin has been used to read file. Required feature is to allow user to select a file from device and upload it. Upload to server is in base64 format. Kindly advise


-- 
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] Yura13 commented on issue #426: Storage updates in Android 11

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


   Verify installed sdk version on your computer via Android SDK
   ![image](https://user-images.githubusercontent.com/17030431/142410723-82f03503-eec8-4408-ba66-63b84136c5bb.png)
   
   Also, try to run the next commands in terminal:
   ```
   ionic cordova platform rm android
   ionic cordova platform add android@9
   ```


-- 
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] hanslbua commented on issue #426: Storage updates in Android 11

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


   Hey i have it like this:
   
   `window.resolveLocalFileSystemURL(file, resolveOnSuccess, function () { console.log("resolveLocalFileSystemURL Error"); }); `
   
   ```
   function resolveOnSuccess(entry){ 
       //new file name
   
       let fileName = "test.jpg"
       let myFolderApp = "app_media";
   
       window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSys) {      
       //The folder is created if doesn't exist
       fileSys.root.getDirectory( myFolderApp,
                       {create:true, exclusive: false},
                       function(directory) {
                           entry.copyTo(directory, fileName,  successCopy, function () { console.log("copyTo Error"); });
                       }
                       , function () { console.log("getDirectory Error"); });
                       },
       function () { console.log("requestFileSystem Error"); });
   }
   ```
   
   Output is: getDirectory Error
   
   Can anyone help me?


-- 
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] victorvhpg commented on issue #426: Storage updates in Android 11

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


   Please update plugin to use MediaStore APIs too, and remove flag "requestLegacyExternalStorage" or make this flag optional


-- 
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.

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 #426: Storage updates in Android 11

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


   ## What should work
   
   > window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory + "/Download" used to work 
   
   - This should work as is when targeting API 28 (now forbidden by Google Play)
   - This should work when targeting API 29 with the dev version of the plugin (which has the `android:requestLegacyExternalStorage="true"`), alternatively you can use the [<edit-config>](https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#edit-config) to add this flag.
   - This won't work when targeting API 30, as API 30 ignores the `android:requestLegacyExternalStorage` attribute.
   
   It's important to read the [Android Notes](https://developer.android.com/training/data-storage/use-cases#migrate-legacy-storage) before you target API 30. You may need to migrate your files to another folder to maintain access to them when targeting API 30 using the new APIs.
   
   ## Who this will affect
   
   This will affect any app that reads or writes to the external file system (aka the `cordova.file.external*`). If you don't use external file paths, then you probably don't need any changes in your app.
   
   I'll be adding a help wanted label. We don't have a planned solution yet. If a volunteer would take the lead and finding a solution to prepare a PR, I encourage to use our [Dev Mailing List](https://cordova.apache.org/contact/) so that we can discuss requirements and potential solutions.
   
   Useful Links: https://developer.android.com/about/versions/11/privacy/storage


----------------------------------------------------------------
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.

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] snr-lab commented on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
snr-lab commented on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-767274266


   Hi,
   
   I am getting com.android.builder.internal.aapt.v2.Aapt2Exception exception after adding android:requestLegacyExternalStorage="true" using edit config. Any help is appreciated.


----------------------------------------------------------------
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.

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] victorvhpg commented on issue #426: Storage updates in Android 11

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


   > I am using ionic 4 and I faced the same issue so I tried the ionic 4 version of resolveDirectoryUrl(cordova.file.externalRootDirectory, function (dirEntry) {)) and on success function I used dirEntry.getDirectory ('Download'... and I can create folders and save files to the Download folders on android 11 without adding android:requestLegacyExternalStorage="true". Here is the code for ionic 4. I have also tried to convert it to the normal web version.
   > 
   > ```
   > createDirectory(rootDir) {
   >     return new Promise((res, rej) => {
   >       this.file.resolveDirectoryUrl(rootDir).then((rootDirEntry)=>{
   >         
   >         rootDirEntry.getDirectory('Download', { create: false, exclusive:false},  (dirEntry) =>{
   >           dirEntry.getDirectory('updates', { create: true, exclusive:false}, (subDirEntry) =>{
   >             this.updateDir = subDirEntry;
   >             this.appDir = dirEntry;
   >             res(this.updateDir)
   >           }, (err)=> {
   >             this.onErrorGetDir(rootDir+'Download/','updates');
   >             rej(err)
   >           })
   >         }, (err)=> {
   >           this.onErrorGetDir(rootDir,'Download')
   >           rej(err)
   >         })
   >       })
   >       
   >     })
   >   }
   > ```
   > 
   > and the normal web version. Note that I have only tested the ionic 4 version of this code.
   > 
   > ```
   > function createDirectory(rootDir /*cordova.file.externalRootDirectory*/) {
   >     window.resolveDirectoryURL(rootDir, function (rootDirEntry) {
   >       dirEntry.getDirectory('Download', { create: false, exclusive:false}, function (dirEntry) {
   >         dirEntry.getDirectory('updates', { create: true, exclusive:false}, function (subDirEntry) {
   >             /* delete a file or donwload a file using cordova-plugin-advanced-http.
   >                 I tested mine using cordova-plugin-advanced-http to download a file to this folder */
   >             createFile(subDirEntry, "fileInNewSubDir.txt");
   > 
   >         }, onErrorGetDir);
   >       }, onErrorGetDir);
   >     })
   >   }
   > ```
   > 
   > This doesn't allow you to write or read from the root directory but works with the download directory and probably other sub directories in the root directory.
   > You will need READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions.
   
   i can't delete/update a file inside 'Download' folder  without flag 'requestLegacyExternalStorage'  


-- 
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   Thank you @breautek , I will check it out
   
   If I understood correctly, it seems that a way to overcome the objections raised by new policy on Android 11+ is to use the [Storage Access Framework](https://developer.android.com/guide/topics/providers/document-provider). This Framework opens a system file picker and we can use it to open or save files with the intents `ACTION_OPEN_DOCUMENT` or `ACTION_CREATE_DOCUMENT`. This plugin could have a method that would trigger these intents with a file picker
   
   ```java
   // Request code for creating a PDF document.
   private static final int CREATE_FILE = 1;
   
   private void createFile(Uri pickerInitialUri) {
       Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
       intent.addCategory(Intent.CATEGORY_OPENABLE);
       intent.setType("application/pdf");
       intent.putExtra(Intent.EXTRA_TITLE, "invoice.pdf");
   
       // Optionally, specify a URI for the directory that should be opened in
       // the system file picker when your app creates the document.
       intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, pickerInitialUri);
   
       startActivityForResult(intent, CREATE_FILE);
   }
   ```
   
   You can then access external storage
   
   > 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**. 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 create, open, or modify.
   
   in https://developer.android.com/training/data-storage/shared/documents-files#java
   
   Maybe I'm missing or misunderstanding something, please correct me if I am.


-- 
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.

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] HarelM commented on issue #426: Storage updates in Android 11

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


   @breautek do you think a PR with only removing the `requestLegacyExternalStorage=true` here would move this issue a bit forward?
   Here's what I have in my inbox in play store console right now (I'm using a version from this repo and not a official version):
   1. New apps must target API 30 by August, updates must target it by November
   2. You are using the above flag, don't, we'll remove your app by may 5th
   
   So just removing this flag would allow using the latest version of this plugin from this repository which is not/will not be possible in a few weeks...
   
   As I said earlier, I have stopped using external storage almost completely after the release of Android 10 since I kinda figured this would be the direction google is going for... I still have issues opening files though which is annoying but I also solved this by associating files with my app and in general avoid using files but rather upload content to a server and store user data in a database...
   I'm beginning to think that using files is what we are used to from the old windows environment where folder and files were important, but as time progresses I see that more and more services are cloud based, and the usage of files is becoming annoying and inconvenient (compare the UX of word to google docs - the fact that in google docs everything is there, available, allows multiple users to edit, share, see and what not seems like the future to me... I might be completely wrong though :-))


-- 
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.

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] victorvhpg edited a comment on issue #426: Storage updates in Android 11

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


   > Right now on Android 11 you can't
   > […](#)
   
   I know. This a big issue. This plugin need to use MediaStore API for that issue


-- 
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.

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] victorvhpg commented on issue #426: Storage updates in Android 11

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


   > @victorvhpg Google will not remove apps with that flag to true, it will simply ignore that flag on Android 11+. Google will remove indeed apps with `MANAGE_EXTERNAL_STORAGE` permission with no valid reason therefor.
   
   Sorry, you is right, the flag will ignored.
   I dont wanna use 
   `MANAGE_EXTERNAL_STORAGE`  ( all device files)
   Only a public/shared folder like "download" its good for me.
   


-- 
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.

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] Vatsov commented on issue #426: Storage updates in Android 11

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


   Thanks, @HarelM ,
   Unfortunately this won't work in my case because I'm trying to read a file


----------------------------------------------------------------
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   Great, thanks, indeed I made
   ```
   cordova plugin rm cordova-plugin-file
   cordova plugin add https://github.com/apache/cordova-plugin-file.git
   ```
   
   I tested it now and it allows me to use `cordova.file.externalRootDirectory + "/Download"` in Android 10 (API 29)
    
   > Yes, but you still need to use build tools version 29, otherwise the build will fail to recognize `android:requestLegacyExternalStorage`.
   
   Did you mean this in `config.xml`?
   ```
   <preference name="android-targetSdkVersion" value="29"/>
   ```
   
   Thanks in advance


----------------------------------------------------------------
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.

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] jfoclpf commented on issue #426: Storage updates in Android 11

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


   @breautek thanks. I also used your answer, citing the source, to reply [on stackoverflow the open issue](https://stackoverflow.com/questions/65668470/how-to-save-a-file-on-shared-space-in-cordova-with-android).


----------------------------------------------------------------
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.

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] HarelM commented on issue #426: Storage updates in Android 11

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


   I've recently implanted a small android app which had to save images to a folder/media storage so I might publish my conclusions here once I'm done...


----------------------------------------------------------------
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.

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 #426: Storage updates in Android 11

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


   > @breautek thanks for the proposed solution.
   > 
   > Does this also fix Writing to external Files like ( /Download ) on SDK 30 ?
   
   It should. I didn't test writing to the `Downloads` directory explicitly, but feel free to augment my test app https://github.com/breautek/cordova-file-api30-test-app/blob/86b1c9135f1e68e62ddc2d874fd82cd933cb9392/www/js/index.js#L173


-- 
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.

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] darnok333 edited a comment on issue #426: Storage updates in Android 11

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


   Hello,
   I just want to share a solution I found to my problem as it's related to this thread.
   
   
   **Problem with SDK 30 :**
   Out team used the path externalApplicationStorageDirectory to store some assets of the application, wich are downloaded the first time the user connect to the application.
   But we weren't able to access those files, and got an ACCESS_DENIED error.
   
   
   **Solution :**
   I made a little modification in CordovaActivity.java in init() function
   
   ```
   `protected void init() {
       appView = makeWebView();
       createViews();
       if (!appView.isInitialized()) {
           appView.init(cordovaInterface, pluginEntries, preferences);
       }
     
       /********** MODIFICATION SDK 30 **********/
           WebView webView = (SystemWebView)(appView.getEngine().getView());
           WebSettings webSettings = webView.getSettings();
           webSettings.setAllowFileAccess(true);
       /**********************************/
     
       cordovaInterface.onCordovaInit(appView.getPluginManager());
     
       // Wire the hardware volume controls to control media if desired.
       String volumePref = preferences.getString("DefaultVolumeStream", "");
       if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) {
           setVolumeControlStream(AudioManager.STREAM_MUSIC);
       }
    }`
   ```
   
   
   you also need to add these import :
   
   import android.webkit.WebView;
   import android.webkit.WebSettings;
   import org.apache.cordova.engine.SystemWebView;
   
   
   Hope this can help some of you :)
   


-- 
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] jfoclpf edited a comment on issue #426: Storage updates in Android 11

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


   Right now on Android 11 you can't with this plugin 


-- 
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.

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] interstellerS commented on issue #426: Storage updates in Android 11

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


   @breautek  In your test you write to file to `externalApplicationStorageDirectory` , I tested it . That works fine.
   
   I intend to save the file to `Download` folder inside `externalRootDirectory`.
   
   > externalRootDirectory is readable, but not writable. You cannot create directories or files inside this directory anymore.
   
   I read your previous comment , but Is there any workaround or other plugin/method to save files to the public android `Download` directory ?


-- 
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.

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] HarelM commented on issue #426: Storage updates in Android 11

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


   `cordova-plugin-x-socialsharing`
   https://github.com/IsraelHikingMap/Site/blob/6b658ae41f5a21d582ac15ee18385af4f128c6ac/IsraelHiking.Web/package.json#L116


-- 
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.

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] alex-steinberg commented on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
alex-steinberg commented on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-978881873


   Thank you for the explanation @breautek. My issue was that I wasn't using WebViewAssetLoader. Simply replacing `file://` with `https://localhost` in my JavaScript allowed me to access my files from the webview in Android 11.
   
   @brunoalex are you able to access `https://localhost/data/user/0/events.staff.booking.app/cache/FB_IMG_1637505177709.jpg` in your JavaScript?


-- 
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] Topiya commented on issue #426: Storage updates in Android 11

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


   @breautek I have added AndroidInsecureFileModeEnabled in config.xml but it is not woking for me.


-- 
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 #426: Storage updates in Android 11

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


   cant acess the file :/ in sdk 30


-- 
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] Topiya edited a comment on issue #426: Storage updates in Android 11

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


   If I add cordova-android 10.1.0 then only it shows Android target: android-30 while _ionic cordova platform add android_.
   
   PS D:\Project> ionic cordova platform add android@10.1.0
   > cordova.cmd platform add android@10.1.0
   Using cordova-fetch for cordova-android@10.1.0
   Adding android project...
   Creating Cordova project for the Android platform:
           Path: platforms\android
           Package: test.test
           Name: test
           Activity: MainActivity
           Android target: android-30


-- 
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] Topiya commented on issue #426: Storage updates in Android 11

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


   If I add cordova-android 10.1.0 then only it shows Android target: android-30 while add platform.
   
   PS D:\Project> ionic cordova platform add android@10.1.0
   > cordova.cmd platform add android@10.1.0
   Using cordova-fetch for cordova-android@10.1.0
   Adding android project...
   Creating Cordova project for the Android platform:
           Path: platforms\android
           Package: test.test
           Name: test
           Activity: MainActivity
           Android target: android-30


-- 
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 #426: Storage updates in Android 11

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


   @alex-steinberg  i can acess the file, but the funtions i used to upload the file after selecting from the galery to the server arent working in sdk30..  "ft.upload(imageURI, server, function(r)" ...  


-- 
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] savitabangera commented on issue #426: Storage updates in Android 11

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


   > #please let me know I'm also facing same issue for android 11 device (Cordova android@10 ). code :
   > 
   > window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory, function(dir) { dir.getFile("test.pdf", {create:true}, function(file) { file.createWriter(function(fileWriter) { fileWriter.write("byteArrays data"); alert('Message', 'File Downloaded Successfully'); }, function(){ alert('Error!', "Unable to save the file"); }); },function(e){ alert('Error!', e); }); },function(e){ console.log(e); });
   > 
   > https://stackoverflow.com/questions/70110433/cordova-file-externalrootdirectory-not-working-in-android-11-devices
   
   Have you got a solution to this @Maheshvy 


-- 
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] Maheshvy edited a comment on issue #426: Storage updates in Android 11

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


   #please let me know I'm also facing same issue for android 11 device (Cordova android@10 ).
   code :
   
   window.resolveLocalFileSystemURL(cordova.file.externalRootDirectory, function(dir) {
       dir.getFile("test.pdf", {create:true}, function(file) {
           file.createWriter(function(fileWriter) {
           fileWriter.write("byteArrays data");
               alert('Message', 'File Downloaded Successfully');
           }, function(){
               alert('Error!', "Unable to save the file");
           });
       },function(e){
           alert('Error!', e);
       });
   },function(e){
       console.log(e);
   });
   
   **I tried with below code in Androidmainfest file**
   
   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.ACTION_MANAGE_STORAGE" />
   <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
   
   **Config.xml file**
   <preference name="AndroidInsecureFileModeEnabled" value="true" />
   <preference name="AndroidPersistentFileLocation" value="Compatibility" />
   
   


-- 
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] rmeyers4 commented on issue #426: Storage updates in Android 11

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


   I work on an application that allows users to create directories in `externalRootDirectory` and save various files into these directories (QR codes, log files, csv files, etc). Users expect to be able to copy files off of the tablet when using a Windows computer to explore the tablet file system.
   
   After spending a bunch of time trying to migrate this functionality to allow files to be saved to `externalApplicationStorageDirectory`, I discovered a potentially much simpler solution. From my testing so far, applications using this plugin and opting in to Scoped Storage can still create directories and write files to the `Documents` folder in `externalRootDirectory`.
   
   I tested this on API 29 with Scoped Storage enabled on an Android 11 tablet by going to Developer Options -> App Compatibility Changes -> <my application> and turning on  `FORCE_ENABLED_SCOPED_STORAGE` and
    all of the "Enabled for targetSdkVersion > 29 features" except for `NATIVE_HEAP_POINTER_TAGGING`.
   
   I then targeted API 30 and added the following to `config.xml`:
   ```
     <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
       <application android:allowNativeHeapPointerTagging="false"/>
     </edit-config>
   
   ```
   https://developer.android.com/guide/topics/manifest/application-element#allowNativeHeapPointerTagging
   
   My application seems to function as it did without scoped storage as long as I prefix my paths with `Documents/` when targeting API 29 and API 30.  We will need to train our users to expect files to be in this location, but (so far) this seems much simpler than trying to use app-specific storage.
   
   I hope this helps someone else, or hope someone tells me why I'm wrong!
   


-- 
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] ivanolarocca edited a comment on issue #426: Storage updates in Android 11

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


   > `Starting November 1, 2021, updates to apps and games on Google Play will be required to target Android 11 (API level 30) or higher.`
   > 
   > I have tried to apply a couple of solutions from this thread but it didn't work.
   > 
   > Also, I've tried manually adding the needed permission but 'android.permission.MANAGE_EXTERNAL_STORAGE' don't appear in `AndroidManifest.xml` after I add to config.xml next part:
   > 
   > ```
   >     <config-file file="app/src/main/AndroidManifest.xml" mode="merge" parent="/manifest" xmlns:android="http://schemas.android.com/apk/res/android">
   >       <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
   >     </config-file>
   > ```
   > 
   > package.json
   > 
   > ```
   >     "cordova-android": "^9.1.0",
   >     "cordova-js": "^5.0.0",
   > ```
   
   1. Set "android-targetSdkVersion" to "30"
   2. Update "cordova-version" from 9 to 10
   3. Set the preserveLegacyExternalStorage flag to true to preserve the legacy storage model so that your app can migrate a user's data when they upgrade to the new version of your app that targets Android 11. 
   `<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
               <application android:preserveLegacyExternalStorage="true" />
           </edit-config>` [(source)](https://developer.android.com/training/data-storage/use-cases#if_your_app_targets)
   4. Check latest cordova plugins update and fixs to support new android sdk target [(cordova-android 10 release highlights)](https://cordova.apache.org/announcements/2021/07/20/cordova-android-10.0.0.html)


-- 
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] ivanolarocca commented on issue #426: Storage updates in Android 11

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


   > `Starting November 1, 2021, updates to apps and games on Google Play will be required to target Android 11 (API level 30) or higher.`
   > 
   > I have tried to apply a couple of solutions from this thread but it didn't work.
   > 
   > Also, I've tried manually adding the needed permission but 'android.permission.MANAGE_EXTERNAL_STORAGE' don't appear in `AndroidManifest.xml` after I add to config.xml next part:
   > 
   > ```
   >     <config-file file="app/src/main/AndroidManifest.xml" mode="merge" parent="/manifest" xmlns:android="http://schemas.android.com/apk/res/android">
   >       <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
   >     </config-file>
   > ```
   > 
   > package.json
   > 
   > ```
   >     "cordova-android": "^9.1.0",
   >     "cordova-js": "^5.0.0",
   > ```
   
   1. Set "android-targetSdkVersion" to "30"
   2. Update "cordova-version" from 9 to 10
   3. Set the preserveLegacyExternalStorage flag to true to preserve the legacy storage model so that your app can migrate a user's data when they upgrade to the new version of your app that targets Android 11. 
   `<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
               <application android:preserveLegacyExternalStorage="true" />
           </edit-config>` [(source)](https://developer.android.com/training/data-storage/use-cases#if_your_app_targets)
   4. Check latest cordova plugins update and fixs to support new android sdk target


-- 
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] alex-steinberg commented on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
alex-steinberg commented on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-961672647


   I don't think anything will work until this plugin uses the new scoped storage APIs. This issue has the label "Help wanted" so if anyone feels like getting their hands dirty with Java that would be great. My time would be better spent migrating to Capacitor.


-- 
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] alex-steinberg commented on issue #426: Storage updates in Android 11

Posted by GitBox <gi...@apache.org>.
alex-steinberg commented on issue #426:
URL: https://github.com/apache/cordova-plugin-file/issues/426#issuecomment-966835004


   > Does anyone has a solution for the problem with SDKVersion 30?
   
   I don't but I can confirm that Capacitor's [Filesystem](https://capacitorjs.com/docs/apis/filesystem) plugin works great and uses all the new Android APIs under the hood i.e. you get a `content://` URL that you can actually use when storing your files.
   
   The ground seems to be shrinking beneath Cordova's feet at an accelerating rate and there's no better time to migrate to Capacitor than now. It's really stable, is a pleasure to use and the migration should be fairly painless.


-- 
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] hanslbua edited a comment on issue #426: Storage updates in Android 11

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






-- 
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