File privateStorage = StorageService.create() .flatMap(StorageService::getPrivateStorage) .orElseThrow(() -> new FileNotFoundException("Could not access private storage.")););}
android.permission.WRITE_EXTERNAL_STORAGE are required if you want to access the external
storage on the device for read and/or write operations respectively. Defining write permissions implicitly
activate read permissions as well.
<manifest ...> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> ... <activity android:name="com.gluonhq.impl.attach.android.PermissionRequestActivity" /> </manifest>
iOS Configuration: none
Method SummaryModifier and TypeMethodDescription
create()Get a storage directory that is private to the environment that is calling this method.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.
- An instance of
getPrivateStorageGet 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.
- an optional with a private storage directory for an application
getPublicStorageGet 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
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.
subdirectory- under the root of public storage that is required. On Android the supplied subdirectory should not be null.
- 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.
isExternalStorageWritableboolean isExternalStorageWritable()Checks if external storage is available for read and write access.
- true if the externalStorage is writable (implies readable), false otherwise
isExternalStorageReadableboolean isExternalStorageReadable()Checks if external storage is available for read access.
- true if the externalStorage is at least readable, false otherwise