Provides utility functions for Android.
More...
|
|
int | getUserId () |
| template<typename T> |
| T | getSystemProperty (const std::string &key, T defaultValue) |
| | Get an Android system property as a typed value.
|
|
int | getVersion () |
| | Returns the version of the Android operating system.
|
|
int | getSDK () |
| | Returns the SDK version of the Android operating system.
|
|
bool | is64BitSupported () |
| | Returns true if Android operating system supports 64bit.
|
| std::string | getExternalStorage () |
| | Get the base external storage directory.
|
| std::string | getAppInternalDataDir (const std::string &packageName) |
| | Get the Android app-specific internal data directory.
|
| std::string | getAppInternalFilesDir (const std::string &packageName) |
| | Get the Android app-specific internal files directory.
|
| std::string | getAppInternalCacheDir (const std::string &packageName) |
| | Get the Android app-specific internal cache directory. the system usually sets the TMPDIR environment variable. If TMPDIR is not set, it falls back to /data/user/<user_id>/<package_name>/cache.
|
| std::string | getAppExternalDataDir (const std::string &packageName) |
| | Get the Android app-specific external data directory.
|
| std::string | getAppExternalFilesDir (const std::string &packageName) |
| | Get the Android app-specific external files directory.
|
| std::string | getAppExternalCacheDir (const std::string &packageName) |
| | Get the Android app-specific external cache directory.
|
| std::string | getAppExternalMediaDir (const std::string &packageName) |
| | Get the Android app-specific external media directory (Android 10+).
|
| std::string | getAppObbDir (const std::string &packageName) |
| | Get the Android app-specific OBB directory.
|
Provides utility functions for Android.
◆ getAppExternalCacheDir()
| std::string KittyUtils::Android::getAppExternalCacheDir |
( |
const std::string & | packageName | ) |
|
|
inline |
Get the Android app-specific external cache directory.
Equivalent to: Context.getExternalCacheDir()
Example: /storage/emulated/0/Android/data/<package>/cache
- Parameters
-
| packageName | Android application package name. |
- Returns
- Absolute path to external cache directory.
◆ getAppExternalDataDir()
| std::string KittyUtils::Android::getAppExternalDataDir |
( |
const std::string & | packageName | ) |
|
|
inline |
Get the Android app-specific external data directory.
Example: /storage/emulated/0/Android/data/<package>
- Parameters
-
| packageName | Android application package name. |
- Returns
- Absolute path to app external data.
◆ getAppExternalFilesDir()
| std::string KittyUtils::Android::getAppExternalFilesDir |
( |
const std::string & | packageName | ) |
|
|
inline |
Get the Android app-specific external files directory.
Equivalent to: Context.getExternalFilesDir(null)
Example: /storage/emulated/0/Android/data/<package>/files
- Parameters
-
| packageName | Android application package name. |
- Returns
- Absolute path to external files directory.
◆ getAppExternalMediaDir()
| std::string KittyUtils::Android::getAppExternalMediaDir |
( |
const std::string & | packageName | ) |
|
|
inline |
Get the Android app-specific external media directory (Android 10+).
Example: /storage/emulated/0/Android/media/<package>
- Parameters
-
| packageName | Android application package name. |
- Returns
- Absolute path to external media directory.
◆ getAppInternalCacheDir()
| std::string KittyUtils::Android::getAppInternalCacheDir |
( |
const std::string & | packageName | ) |
|
Get the Android app-specific internal cache directory. the system usually sets the TMPDIR environment variable. If TMPDIR is not set, it falls back to /data/user/<user_id>/<package_name>/cache.
Equivalent to: Context.getCacheDir()
Example: /data/user/<user_id>/<package_name>/cache
- Parameters
-
| packageName | Android application package name. |
- Returns
- Absolute path to app internal cache directory.
◆ getAppInternalDataDir()
| std::string KittyUtils::Android::getAppInternalDataDir |
( |
const std::string & | packageName | ) |
|
Get the Android app-specific internal data directory.
Equivalent to: Context.getDataDir()
Example: /data/user/<user_id>/<package_name>
- Parameters
-
| packageName | Android application package name. |
- Returns
- Absolute path to app internal data directory.
◆ getAppInternalFilesDir()
| std::string KittyUtils::Android::getAppInternalFilesDir |
( |
const std::string & | packageName | ) |
|
Get the Android app-specific internal files directory.
Equivalent to: Context.getFilesDir()
Example: /data/user/<user_id>/<package_name>/files
- Parameters
-
| packageName | Android application package name. |
- Returns
- Absolute path to app internal files directory.
◆ getAppObbDir()
| std::string KittyUtils::Android::getAppObbDir |
( |
const std::string & | packageName | ) |
|
|
inline |
Get the Android app-specific OBB directory.
Example: /storage/emulated/0/Android/obb/<package>
- Parameters
-
| packageName | Android application package name. |
- Returns
- Absolute path to OBB directory.
◆ getExternalStorage()
| std::string KittyUtils::Android::getExternalStorage |
( |
| ) |
|
|
inline |
Get the base external storage directory.
Usually: /storage/emulated/0
Uses the EXTERNAL_STORAGE environment variable.
- Returns
- Absolute path to external storage root, falls back to "/sdcard" if not defined.
◆ getSystemProperty()
template<typename T>
| T KittyUtils::Android::getSystemProperty |
( |
const std::string & | key, |
|
|
T | defaultValue ) |
|
inline |
Get an Android system property as a typed value.
Supports std::string, bool, integral, and floating-point types. Returns defaultValue if the property is missing or conversion fails.
- Template Parameters
-
- Parameters
-
| key | Property name (e.g., "ro.build.version.sdk") |
| defaultValue | Value returned if property not found or conversion fails |
- Returns
- Property value converted to T