-
public class SimpleStorage.Companion
-
-
Field Summary
Fields Modifier and Type Field Description private final StringKITKAT_SD_CARD_PATHprivate final StringexternalStoragePathprivate final BooleanisSdCardPresentpublic final static SimpleStorage.CompanionINSTANCE
-
Method Summary
Modifier and Type Method Description final IntentgetDefaultExternalStorageIntent(Context context)final BooleanhasStoragePermission(Context context)For read and write permissions final BooleanhasStorageReadPermission(Context context)For read permission only final BooleanhasFullDiskAccess(Context context, String storageId)final BooleanhasStorageAccess(Context context, String fullPath, Boolean requiresWriteAccess)In API 29+, /storage/emulated/0may not be granted for URI permission, but all directories under/storage/emulated/0/Downloadare granted and accessible.final BooleanhasStorageAccess(Context context, String fullPath)In API 29+, /storage/emulated/0may not be granted for URI permission, but all directories under/storage/emulated/0/Downloadare granted and accessible.final UnitcleanupRedundantUriPermissions(Context context)Max persistable URI per app is 128, so cleanup redundant URI permissions. final StringgetKITKAT_SD_CARD_PATH()final StringgetExternalStoragePath()final BooleangetIsSdCardPresent()-
-
Method Detail
-
getDefaultExternalStorageIntent
final Intent getDefaultExternalStorageIntent(Context context)
-
hasStoragePermission
final Boolean hasStoragePermission(Context context)
For read and write permissions
-
hasStorageReadPermission
final Boolean hasStorageReadPermission(Context context)
For read permission only
-
hasFullDiskAccess
final Boolean hasFullDiskAccess(Context context, String storageId)
-
hasStorageAccess
@JvmOverloads() final Boolean hasStorageAccess(Context context, String fullPath, Boolean requiresWriteAccess)
In API 29+,
/storage/emulated/0may not be granted for URI permission, but all directories under/storage/emulated/0/Downloadare granted and accessible.- Parameters:
requiresWriteAccess-trueif you expect this path should be writable
-
hasStorageAccess
@JvmOverloads() final Boolean hasStorageAccess(Context context, String fullPath)
In API 29+,
/storage/emulated/0may not be granted for URI permission, but all directories under/storage/emulated/0/Downloadare granted and accessible.
-
cleanupRedundantUriPermissions
final Unit cleanupRedundantUriPermissions(Context context)
Max persistable URI per app is 128, so cleanup redundant URI permissions. Given the following URIs:
content://com.android.externalstorage.documents/tree/primary%3AMoviescontent://com.android.externalstorage.documents/tree/primary%3AMovies%2FHorror
Then remove the second URI, because it has been covered by the first URI.
-
getKITKAT_SD_CARD_PATH
final String getKITKAT_SD_CARD_PATH()
-
getExternalStoragePath
final String getExternalStoragePath()
-
getIsSdCardPresent
final Boolean getIsSdCardPresent()
-
-
-
-