What is the corresponding XML for Context.getFilesDir()?
My current XML:
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<files-path name="internal" path="." />
</paths>
File creation:
File video = new File(getFilesDir(), "movie.mp4");
videoUri = FileProvider.getUriForFile(this, "my.package.name.provider", video);
To make FileProvider work follow these three steps: Define the FileProvider in your AndroidManifest file. Create an XML file that contains all paths that the FileProvider will share with other applications. Bundle a valid URI in the Intent and activate it.
FileProvider is a special subclass of ContentProvider that facilitates secure sharing of files associated with an app by creating a content:// Uri for a file instead of a file:/// Uri . A content URI allows you to grant read and write access using temporary access permissions.
That is the XML for serving files from getFilesDir() through FileProvider.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With