Object FileManager

  • All Implemented Interfaces:

    
    public class FileManager
    
                        

    This is a utility class for the clearing the previous version files (or Dbs) on a SDK upgrade. While clearing the Dbs (if any required), if there is a failure then it tries to submit a telemetry event to be reported back if the Sdk has been initialized. If the Sdk has not been initialized properly, the report doesn't get submitted but there is no functionality loss.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final static FileManager INSTANCE
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static Boolean clearFiles(Context context) Method to clear the cached files and db when there is sdk version update
      final static Unit deleteDirectory(File path)
      final static Long getFileSize(String fileLocationOnDevice) Method to get the size of file passed
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • clearFiles

         final static Boolean clearFiles(Context context)

        Method to clear the cached files and db when there is sdk version update

        Parameters:
        context - A context object to access the application methods
        Returns:

        false if all old Dbs were cleared successfully, true otherwise

      • getFileSize

         final static Long getFileSize(String fileLocationOnDevice)

        Method to get the size of file passed

        Parameters:
        fileLocationOnDevice - the actual path of file for which size needs to be calculated
        Returns:

        the file size(in Bytes) if it exists on the device, else returns 0.