
public class StorageUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
StorageUtils.StorageInfo |
| Modifier and Type | Field and Description |
|---|---|
static String |
EXTERNAL_SD_CARD |
static String |
SD_CARD |
| Constructor and Description |
|---|
StorageUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Map<String,File> |
getAllStorageLocations()
Deprecated.
As of 6.1.7, use
getStorageList() instead. |
static StorageUtils.StorageInfo |
getBestWritableStorage()
Gets the best possible storage location by free space
|
static StorageUtils.StorageInfo |
getBestWritableStorage(Context context)
Gets the best possible storage location by free space
|
static String |
getSdCardPath()
Deprecated.
As of 6.1.7, will be removed in the future.
|
static File |
getStorage()
Deprecated.
As of 6.1.7, use
getBestWritableStorage() instead. |
static File |
getStorage(Context context)
Deprecated.
As of 6.1.7, use
getBestWritableStorage(Context) instead. |
static List<StorageUtils.StorageInfo> |
getStorageList()
Attention! This method only gets storage locations that are context independent.
|
static List<StorageUtils.StorageInfo> |
getStorageList(Context context)
Detects all available storage locations, writable or not.
|
static boolean |
isAvailable()
Deprecated.
As of 6.1.7, will be removed in the future.
|
static boolean |
isWritable()
Deprecated.
As of 6.1.7, will be removed in the future.
|
static boolean |
isWritable(File path) |
public static final String SD_CARD
public static final String EXTERNAL_SD_CARD
public static List<StorageUtils.StorageInfo> getStorageList()
getStorageList(Context) instead!List of StorageUtils.StorageInfo of all storage paths, writable or not.public static List<StorageUtils.StorageInfo> getStorageList(Context context)
Attention! If context==null this method only gets storage locations that are context independent. Especially it will not return application specific paths like getFilesDir() or getCacheDir(), which might lead to problems especially on API29 and up due to scoped storage restrictions, where this is then guaranteed to return an empty list!
List of StorageUtils.StorageInfo of all storage paths, writable or not.@Deprecated public static File getStorage()
getBestWritableStorage() instead.
Attention! This method only gets storage locations that are context independent. Especially
it does not return application specific paths like getFilesDir() or getCacheDir(), which
might lead to problems especially on API29 and up due to scoped storage restrictions, where
this method will always return null!
It's always recommended to use getBestWritableStorage(Context) instead!
public static StorageUtils.StorageInfo getBestWritableStorage()
Attention! This method only gets storage locations that are context independent. Especially
it does not return application specific paths like getFilesDir() or getCacheDir(), which
might 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
IConfigurationProvider.setOsmdroidTileCache(File).
StorageUtils.StorageInfo object.@Deprecated public static File getStorage(Context context)
getBestWritableStorage(Context) instead.Attention! If context==null this method only gets storage locations that are context independent. Especially it will not return application specific paths like getFilesDir() or getCacheDir(), which might lead to problems especially on API29 and up due to scoped storage restrictions, where this is then guaranteed to return null!
public static StorageUtils.StorageInfo getBestWritableStorage(Context context)
Attention! If context==null this method only gets storage locations that are context independent. Especially it will not return application specific paths like getFilesDir() or getCacheDir(), which might lead to problems especially on API29 and up due to scoped storage restrictions, where this is then guaranteed to return null!
StorageUtils.StorageInfo object.@Deprecated public static boolean isAvailable()
@Deprecated public static String getSdCardPath()
@Deprecated public static boolean isWritable()
public static boolean isWritable(File path)
public static Map<String,File> getAllStorageLocations()
getStorageList() instead.Map of all storage locations available