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: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
