Module com.gluonhq.attach.storage
Package com.gluonhq.attach.storage.impl
Class AndroidStorageService
java.lang.Object
com.gluonhq.attach.storage.impl.AndroidStorageService
- All Implemented Interfaces:
StorageService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet a storage directory that is private to the environment that is calling this method.getPublicStorage(String subdirectory) Get a public storage directory location.booleanChecks if external storage is available for read access.booleanChecks if external storage is available for read and write access.
-
Constructor Details
-
AndroidStorageService
public AndroidStorageService()
-
-
Method Details
-
getPrivateStorage
Description copied from interface:StorageServiceGet a storage directory that is private to the environment that is calling this method. In the case of iOS or Android, the returned directory is private to the enclosing application.- Specified by:
getPrivateStoragein interfaceStorageService- Returns:
- an optional with a private storage directory for an application
-
getPublicStorage
Description copied from interface:StorageServiceGet a public storage directory location.Note that on Android the public location could be mapped to a removable memory device and may not always be available. Users of this method are advised to call
StorageService.isExternalStorageWritable()orStorageService.isExternalStorageReadable()to avoid surprises.Note also that on Android, permissions will need to be set to access external storage. See: https://developer.android.com/training/basics/data-storage/files.html.
- Specified by:
getPublicStoragein interfaceStorageService- Parameters:
subdirectory- under the root of public storage that is required. On Android the supplied subdirectory should not be null.- Returns:
- an Optional of a File representing the requested directory location. The location may not yet exist. It is the responsibility of the programmer to ensure that the location exists before using it.
-
isExternalStorageWritable
public boolean isExternalStorageWritable()Description copied from interface:StorageServiceChecks if external storage is available for read and write access.- Specified by:
isExternalStorageWritablein interfaceStorageService- Returns:
- true if the externalStorage is writable (implies readable), false otherwise
-
isExternalStorageReadable
public boolean isExternalStorageReadable()Description copied from interface:StorageServiceChecks if external storage is available for read access.- Specified by:
isExternalStorageReadablein interfaceStorageService- Returns:
- true if the externalStorage is at least readable, false otherwise
-