MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / getStorageAccess

Method getStorageAccess

src/plugins/sdcard/src/android/SDcard.java:315–344  ·  view source on GitHub ↗
(String SDCardUUID, CallbackContext callback)

Source from the content-addressed store, hash-verified

313 }
314
315 public void getStorageAccess(String SDCardUUID, CallbackContext callback) {
316 Intent intent = null;
317
318 if (SDK_INT >= 24) {
319 StorageVolume sdCard = null;
320
321 for (StorageVolume volume : this.storageManager.getStorageVolumes()) {
322 String uuid = volume.getUuid();
323 if (uuid != null && uuid.equals(SDCardUUID)) {
324 sdCard = volume;
325 }
326 }
327
328 if (sdCard != null) {
329 if (SDK_INT < 29) {
330 intent = sdCard.createAccessIntent(null);
331 } else if (SDK_INT >= 29) {
332 intent = sdCard.createOpenDocumentTreeIntent();
333 }
334 }
335 }
336
337 if (intent == null) {
338 REQUEST_CODE = DOCUMENT_TREE;
339 intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
340 }
341
342 activityResultCallback = callback;
343 cordova.startActivityForResult(this, intent, REQUEST_CODE);
344 }
345
346 public void onActivityResult(int requestCode, int resultCode, Intent data) {
347 super.onActivityResult(requestCode, resultCode, data);

Callers 1

executeMethod · 0.95

Calls 1

getStorageVolumesMethod · 0.80

Tested by

no test coverage detected