Class AndroidSharedFileObserver


  • public class AndroidSharedFileObserver
    extends FileObserver
    Implementation of a file observer that detects when a share file has been edited by external apps. Use this to get notified to re-import the file into the drive.
    • Method Detail

      • createFileObserver

        public static AndroidSharedFileObserver createFileObserver​(java.io.File cacheFile,
                                                                   AesFile aesFile,
                                                                   Consumer<AndroidSharedFileObserver> onFileContentsChanged)
        Create a file observer that will detect if the file contents of a shared salmon file have changed
        Parameters:
        cacheFile - The temporary private decrypted cached file
        aesFile - The encrypted file that is associated with the shared file
        onFileContentsChanged - Action notifier when file contents change
        Returns:
        The shared file observer
      • removeFileObserver

        public static void removeFileObserver​(java.io.File cacheFile)
        Remove the shared filed associated with this observer.
        Parameters:
        cacheFile - The cache file.
      • clearFileObservers

        public static void clearFileObservers()
        Clear all file observers. Call this to release any observes you no longer need.
      • onEvent

        public void onEvent​(int e,
                            java.lang.String path)
        When a file event happens.
        Parameters:
        e - The type of event that happened
        path - The path to the monitored file
      • getAesFile

        public AesFile getAesFile()
        Returns the encrypted salmon file that is associated with the shared file
        Returns:
        The file
      • setAesFile

        public void setAesFile​(AesFile aesFile)
        Set the salmon file associated with the shared file to observer.
        Parameters:
        aesFile - The file