Class LibStorageUtils

  • All Implemented Interfaces:

    
    public class LibStorageUtils
    
                        

    Created by Android Studio. User: lvhongzhen Date: 2019-12-02 Time: 14:49

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final static String DIR
      public final static String VIDEO
      public final static String IMAGE
      public final static String FILE
      public final static String AUDIO
      public final static String MEDIA
      public final static String DB_STORAGE
      public final static String DB_STORAGE_PRIVATE
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static boolean isScopedStorageMode(Context context) Indicates whether the app is in partitioned storage mode.
      static boolean isBuildAndTargetForQ(Context context) Indicates whether the Android SDK version is >= Build.VERSION_CODES.Q and the target SDK version is >= Build.VERSION_CODES.Q.
      static boolean isOsAndTargetForR(Context context)
      static String getMediaDownloadDir(Context context) Retrieves the storage path for media files.
      static String getMediaDownloadDir(Context context, String dir) Retrieves the storage path for media files
      static String getFilesDir(Context pContext, String dir)
      static String getAppName(Context context) Retrieves the application name
      • Methods inherited from class java.lang.Object

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

      • LibStorageUtils

        LibStorageUtils()
    • Method Detail

      • isScopedStorageMode

         static boolean isScopedStorageMode(Context context)

        Indicates whether the app is in partitioned storage mode. For apps targeting Android 11 targetSdkVersion>=30, you must set rc_q_storage_mode_enable to true; otherwise, sending media files such as images and documents will fail.

        Parameters:
        context - The context
        Returns:

        Whether the app is in Android 11 storage mode

      • isBuildAndTargetForQ

         static boolean isBuildAndTargetForQ(Context context)

        Indicates whether the Android SDK version is >= Build.VERSION_CODES.Q and the target SDK version is >= Build.VERSION_CODES.Q.

        Parameters:
        context - The context
        Returns:

        Whether the Android SDK version is >= Build.VERSION_CODES.Q and the target SDK version is >= Build.VERSION_CODES.Q

      • isOsAndTargetForR

         static boolean isOsAndTargetForR(Context context)
        Returns:

        Indicates whether the system version is >=R and the target platform is target >= Build.VERSION_CODES.R

      • getMediaDownloadDir

        @Deprecated() static String getMediaDownloadDir(Context context)

        Retrieves the storage path for media files.

        Parameters:
        context - The context.
        Returns:

        The storage path for media files.

      • getMediaDownloadDir

         static String getMediaDownloadDir(Context context, String dir)

        Retrieves the storage path for media files

        Parameters:
        context - The context
        dir - The custom directory
        Returns:

        The storage path for media files

      • getFilesDir

         static String getFilesDir(Context pContext, String dir)
      • getAppName

         static String getAppName(Context context)

        Retrieves the application name

        Parameters:
        context - The context
        Returns:

        The application name