Reputation: 853
Let's say I create a file inside the private folder like this:
val dir = context.getDir("myDir", Context.MODE_PRIVATE)
val file = File(dir, "myFileName")
What should be the content of provider_path.xml?
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<!--for file created inside context.getFilesDir() directory-->
<files-path name="someDirectory" path="."/>
<!--for files created inside "myDir" ???-->
</paths>
I know how to get the URI for a file created inside context.getFilesDir(), but it is possible to get the URI of a file created inside another private directory?
Thanks in advance!
Upvotes: 1
Views: 803
Reputation: 1007474
What should be the content of provider_path.xml?
If you are referring to FileProvider
, it does not support arbitrary locations, such as getDir("myDir", Context.MODE_PRIVATE)
. Either store your files in a supported location (e.g., a subdirectory off of getFilesDir()
) or write your own ContentProvider
to serve up the files from your custom directory.
Upvotes: 1