CacheFileProvider

General

Category
Free
Tag
Caching
License
N/A
Registered
Jan 8, 2018
Favorites
2
Link
https://github.com/MFlisar/CacheFileProvider
See also
RxCache
Android-Image-Cache
simple-disk-cache
ReactiveCache
QuitNow!'s cache

Additional

Language
Java
Version
0.2 (Feb 22, 2018)
Created
Jan 7, 2018
Updated
Feb 22, 2018
Owner
MFlisar
Contributor
MFlisar
1
Activity
Badge
Generate
Download
Source code

Advertising

CacheFileProvider

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 JitPack.io)

  1. add jitpack to your project's build.gradle:
repositories {
 maven { url "https://jitpack.io" }
}
  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);