mobicontrol.storage.external

This namespace provides access to the external storage functionality.
Since:
  • Version 1.1 (API level 2)

Members

static, readonly dataDirectory :string

Name of agent's external storage directory, or null if shared storage is not available.

For example: "/storage/emulated/0/Android/data/net.soti.mobicontrol.androidwork/files".
Note: If the directory didn't exist prior to the call, it might be created.

Since:
  • Version 1.4 (API level 5)
Example
var apkFile = new mobicontrol.io.File(mobicontrol.storage.external.dataDirectory + '/app.apk');
if(apkFile.exists){
    mobicontrol.log.info("APK file exists");
}

static, readonly documentsDirectory :string

Name of the external storage's Documents directory.

For example: "/storage/emulated/13/Documents".

Since:
  • Version 1.4 (API level 5)
Example
var documentFiles = new mobicontrol.io.File(mobicontrol.storage.external.documentsDirectory).listFiles();
mobicontrol.log.info("Documents count: " + documentFiles.length);

static, readonly downloadsDirectory :string

Name of the external storage's Downloads directory.

For example: "/storage/emulated/13/Download".

Since:
  • Version 1.4 (API level 5)
Example
var downloadedFiles = new mobicontrol.io.File(mobicontrol.storage.external.downloadsDirectory).listFiles();
mobicontrol.log.info(downloadedFiles.map(file => file.path).join());

static, readonly, nullable rootDirectory :string

Name of the external storage's root directory.

For example: "/storage/emulated/13".
This property is null if the external storage's root directory cannot be determined.

Note: This folder might not be accessible on Android 11 or higher due to Scoped storage enforcement. It is recommended to use alternatives like mobicontrol.storage.internal.dataDirectory.

Since:
  • Version 1.1 (API level 2)
Example
var externalRootDirectory = mobicontrol.storage.external.rootDirectory;
mobicontrol.app.install(externalRootDirectory + '/newApp.apk');