-
public class StorageUtils
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classStorageUtils.StorageInfo
-
Field Summary
Fields Modifier and Type Field Description public final static StringSD_CARDpublic final static StringEXTERNAL_SD_CARD
-
Method Summary
Modifier and Type Method Description static List<StorageUtils.StorageInfo>getStorageList()Attention! static List<StorageUtils.StorageInfo>getStorageList(Context context)Detects all available storage locations, writable or not. static FilegetStorage()Gets the best possible storage location by free spaceAttention! static StorageUtils.StorageInfogetBestWritableStorage()Gets the best possible storage location by free spaceAttention! static FilegetStorage(Context context)Gets the best possible storage location by free spaceAttention! static StorageUtils.StorageInfogetBestWritableStorage(Context context)Gets the best possible storage location by free spaceAttention! static booleanisAvailable()static StringgetSdCardPath()static booleanisWritable()static booleanisWritable(File path)static Map<String, File>getAllStorageLocations()-
-
Method Detail
-
getStorageList
static List<StorageUtils.StorageInfo> getStorageList()
Attention! This method only gets storage locations that are context independent. Especiallyit does not return application specific paths like getFilesDir() or getCacheDir(), whichmight lead to problems especially on API29 and up due to scoped storage restrictions, wherethis method will always return an empty list!It's always recommended to use getStorageList instead!
-
getStorageList
static List<StorageUtils.StorageInfo> getStorageList(Context context)
Detects all available storage locations, writable or not.
Attention! If context==null this method only gets storage locations that are contextindependent. Especially it will not return application specific paths like getFilesDir() orgetCacheDir(), which might lead to problems especially on API29 and up due to scoped storagerestrictions, where this is then guaranteed to return an empty list!
-
getStorage
@Deprecated() static File getStorage()
Gets the best possible storage location by free space
Attention! This method only gets storage locations that are context independent. Especiallyit does not return application specific paths like getFilesDir() or getCacheDir(), whichmight lead to problems especially on API29 and up due to scoped storage restrictions, wherethis method will always return null!It's always recommended to use getBestWritableStorage instead!
-
getBestWritableStorage
static StorageUtils.StorageInfo getBestWritableStorage()
Gets the best possible storage location by free space
Attention! This method only gets storage locations that are context independent. Especiallyit does not return application specific paths like getFilesDir() or getCacheDir(), whichmight lead to problems especially on API29 and up due to scoped storage restrictions.For now it is advised to manually determine a proper cache location and set it via setOsmdroidTileCache.
-
getStorage
@Deprecated() static File getStorage(Context context)
Gets the best possible storage location by free space
Attention! If context==null this method only gets storage locations that are contextindependent. Especially it will not return application specific paths like getFilesDir() orgetCacheDir(), which might lead to problems especially on API29 and up due to scoped storagerestrictions, where this is then guaranteed to return null!
-
getBestWritableStorage
static StorageUtils.StorageInfo getBestWritableStorage(Context context)
Gets the best possible storage location by free space
Attention! If context==null this method only gets storage locations that are contextindependent. Especially it will not return application specific paths like getFilesDir() orgetCacheDir(), which might lead to problems especially on API29 and up due to scoped storagerestrictions, where this is then guaranteed to return null!
-
isAvailable
@Deprecated() static boolean isAvailable()
-
getSdCardPath
@Deprecated() static String getSdCardPath()
-
isWritable
@Deprecated() static boolean isWritable()
-
isWritable
static boolean isWritable(File path)
-
getAllStorageLocations
static Map<String, File> getAllStorageLocations()
-
-
-
-