Class AndroidStorageService

java.lang.Object
com.gluonhq.attach.storage.impl.AndroidStorageService
All Implemented Interfaces:
StorageService

public class AndroidStorageService extends Object implements StorageService
  • Constructor Details

    • AndroidStorageService

      public AndroidStorageService()
  • Method Details

    • getPrivateStorage

      public Optional<File> getPrivateStorage()
      Description copied from interface: StorageService
      Get 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:
      getPrivateStorage in interface StorageService
      Returns:
      an optional with a private storage directory for an application
    • getPublicStorage

      public Optional<File> getPublicStorage(String subdirectory)
      Description copied from interface: StorageService
      Get 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() or StorageService.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:
      getPublicStorage in interface StorageService
      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: StorageService
      Checks if external storage is available for read and write access.
      Specified by:
      isExternalStorageWritable in interface StorageService
      Returns:
      true if the externalStorage is writable (implies readable), false otherwise
    • isExternalStorageReadable

      public boolean isExternalStorageReadable()
      Description copied from interface: StorageService
      Checks if external storage is available for read access.
      Specified by:
      isExternalStorageReadable in interface StorageService
      Returns:
      true if the externalStorage is at least readable, false otherwise