Android App can only access the directory specified by the external SD, generally:
$External SD directory + "/Android/data/" + $apk package name
1. Method to obtain the external SD directory:
Call getenv(const char *name) method and get it through the environment variable "SECONDARY_STORAGE". If this variable is not available, get it through "EXTERNAL_STORAGE".
If the above method does not work, enumerate all directories under the /mnt directory.
2 Methods to get the apk package name:
pid_t getpid() gets the process identifier; then the process name is obtained by reading the content of the /proc/$pid/cmdline file, that is, the package name
3 Patch together the sandbox directory:
$External SD directory + "/Android/data/" + $apk package name + "/cache"
The above explanation of the method of obtaining the external SD sandbox directory of Android ndk programs is all the content shared by the editor. I hope it can give you a reference and I hope you can support me more.