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) 是否处于分区存储模式 在以Android 11 为目标平台的应用上targetSdkVersion>=30,必须设置 rc_q_storage_mode_enabletrue, 否则会导致图片,文件等媒体文件发送失败)
      static boolean isBuildAndTargetForQ(Context context) 是否 Android SDK 版本号 >= Build.VERSION_CODES.Q 且 目标软件开发版本 >= Build.VERSION_CODES.Q
      static boolean isOsAndTargetForR(Context context)
      static String getMediaDownloadDir(Context context) 获取媒体文件存储路径
      static String getMediaDownloadDir(Context context, String dir) 获取媒体文件存储路径
      static String getFilesDir(Context pContext, String dir)
      static String getAppName(Context context) 获取应用名称
      • 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)

        是否处于分区存储模式 在以Android 11 为目标平台的应用上targetSdkVersion>=30,必须设置 rc_q_storage_mode_enabletrue, 否则会导致图片,文件等媒体文件发送失败)

        Parameters:
        context - 上下文
        Returns:

        是否处于 android 11 存储模式

      • isBuildAndTargetForQ

         static boolean isBuildAndTargetForQ(Context context)

        是否 Android SDK 版本号 >= Build.VERSION_CODES.Q 且 目标软件开发版本 >= Build.VERSION_CODES.Q

        Parameters:
        context - 上下文
        Returns:

        是否 Android SDK 版本号 >= Build.VERSION_CODES.Q 且 目标软件开发版本 >= Build.VERSION_CODES.Q

      • isOsAndTargetForR

         static boolean isOsAndTargetForR(Context context)
        Returns:

        是否系统版本 >=R 且目标平台 target >= Build.VERSION_CODES.R

      • getMediaDownloadDir

        @Deprecated() static String getMediaDownloadDir(Context context)

        获取媒体文件存储路径

        Parameters:
        context - 上下文
        Returns:

        媒体文件存储路径

      • getMediaDownloadDir

         static String getMediaDownloadDir(Context context, String dir)

        获取媒体文件存储路径

        Parameters:
        context - 上下文
        dir - 自定义目录
        Returns:

        媒体文件存储路径

      • getFilesDir

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

         static String getAppName(Context context)

        获取应用名称

        Parameters:
        context - 上下文
        Returns:

        应用名称