Class LibStorageUtils
-
- All Implemented Interfaces:
public class LibStorageUtils
Created by Android Studio. User: lvhongzhen Date: 2019-12-02 Time: 14:49
-
-
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
-
Constructor Summary
Constructors Constructor Description LibStorageUtils()
-
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 -
-
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 setrc_q_storage_mode_enable
totrue
; 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 istarget >= 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 contextdir
- 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
-
-
-
-