Welcome to Scope Storage Utility Library
This library will help manage your image and file from the Private and Shared storage location and also it handle the Android Scope Storage Policy.
So now you dont have to worry anymore about the struggle of managing file in private or shared storage in different sdk
the benefit of this library are
- Easy to use ✅
- Provide shared and private storage file management and also handle the scope storage policy
as now for the android API 30+ there is a new rule of saving data to shared storage
✅ - Provide synchronous & asynchronous solution ✅
- Safe from throwing an error
the error can be trace by search the logcat of "ScopeStorageUtility"
✅ - For more detail info, see the full doc here Full Documentation Link
Bitmap | File |
---|---|
save bitmap (private & shared) | load outstream for file creation (private & shared) |
delete bitmap (private & shared) | delete file (private & shared) |
load bitmap (private & shared) | get public file URI (shared) |
get public file URI (shared) |
Add jitpack package repository in your root build.gradle at the allprojects inside repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency
dependencies {
...
implementation 'com.github.jiwomdf:Scope-Storage-Utility:VERSION'
}
Please include this permission in your application
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
For android Tiramisu use READ_MEDIA_IMAGES instead of READ_EXTERNAL_STORAGE
This is the example of load png file in shared storage, it already handle loading png
using Media Query API for scope storage device and using the Environment for non scope storage device
manage(this)
.isShareStorage(true)
.attribute(
UtilityModel(
fileName = "test",
directory = "folder/subfolder/",
env = Environment.DIRECTORY_DCIM,
extension = Extension.get(Extension.PNG)
)
)
.load({ bitmap ->
//success
},{
//failed
})
➡️ Full Documentation Link ⬅️
Feel free to see and contribute