feat(android): support custom data location on external sdcard (#2292)
Some checks are pending
Deploy to vercel on merge / build_and_deploy (push) Waiting to run

This commit is contained in:
Huang Xin 2025-10-22 16:14:41 +08:00 committed by GitHub
parent 34a5e58872
commit 50d7f9a9dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 131 additions and 9 deletions

View file

@ -588,6 +588,23 @@ class NativeBridgePlugin(private val activity: Activity): Plugin(activity) {
}
}
@Command
fun get_external_sdcard_path(invoke: Invoke) {
val result = JSObject()
val externalDirs = activity.getExternalFilesDirs(null)
for (file in externalDirs) {
if (file != null && Environment.isExternalStorageRemovable(file)) {
val pathParts = file.absolutePath.split("/Android/")
if (pathParts.isNotEmpty()) {
result.put("path", pathParts[0])
invoke.resolve(result)
}
}
}
result.put("path", null)
invoke.resolve(result)
}
@Command
fun request_manage_storage_permission(invoke: Invoke) {
val ret = JSObject()