I am looking for a way to transfer files between applications running in the following scenario:
- We have a file list in the application, a person clicks the Share button and we show him a dialog to select applications that can receive the file. For example, he can choose Gmail to create a letter to which the selected file will be attached or he can send this file via Bluetooth.
- The file may be in the private directory of our application.
- A file can be located anywhere in the file system, except for places requiring root privileges.
- The application receiving the file may not have
READ_EXTERNAL_STORAGEpermissions. - It should work from API level 14 to the newest versions.
As far as I understand, the only way suitable for all conditions is the implementation in my FileProvider application or your own ContentProvider , which will issue the content URI for the file, and we will attach this URI to ACTION_SHARE Intent with setting FLAG_GRANT_READ_URI_PERMISSION . Is there a simpler alternative?