Visit GitHub Repo

CacheFileProvider Release

What is it / What does it do?

This is a minimal library with a few lines of code and without dependencies that offers a simple cache file provider (simple read only access for sharing files with other apps).

Gradle (via

  1. add jitpack to your project's build.gradle:
repositories {
	maven { url "" }
  1. add the compile statement to your module's build.gradle:
dependencies {
	compile 'com.github.MFlisar:CacheFileProvider:0.2'

Usage - General

  1. Simply create a file in your apps cache directory
File file = new File(getCacheDir() + File.separator + "testfile.txt");
// make sure something is written to this file...
// ....
  1. Simply create a Uri for the file in your cache directory and share it to another app and it will work
Uri shareableUri = CachedFileProvider.getCacheFileUri(appContext, file.getName());

Other things

Get the content providers authority:

String authority = CachedFileProvider.getAuthority(appContext);
Learners From Our Courses Work At