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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to