I found so many links which is related to FileProvider, but I didn't found solution for cache directory
java.lang.IllegalArgumentException: Failed to find configured root that contains
/data/data/pkg name/cache/1487876607264.png
I want to use it for CACHE DIRECTORY, How can I give path in provider.
<paths>
<external-path name="external_files" path="." />
</paths>
I used it as :
File file = new File(context.getCacheDir(), System.currentTimeMillis() + ".png");
Uri uri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".provider", file);
Its working fine if I give application folder path, but not working with Cache Directory.
Any Help?
Use <cache-path>
, not <external-path>
. See the documentation.