Skip to content

Releases: adapt-it/cordova-env

Release 1.1.0

11 Jan 18:52
@eb1 eb1
Compare
Choose a tag to compare

This releases adds access to the kinda-sorta-deprecated Android Environment method getExternalStoragePublicDirectory:

getExternalStoragePublicDirectory

DEPRECATION WARNING
This method has been deprecated on Android API 29 and later.

Parameters:

  • directory: (string) Directory to look up. This needs to be one of the strings returned by the getDirectory() call above.
  • successCallback: Callback that returns the full path string of the specified directory on this device.
  • errorCallback: Callback that executes if an error occurs during the call.

Example

if (navigator.Env) {
    console.log("Env object in navigator");
    // attempt to get Environment.DIRECTORY_DOWNLOADS
    navigator.Env.getDirectory("Downloads", 
        function (dirName) {
            if (dirName) {
                console.log("getDirectory(Downloads) returns: " + dirName);
                // success -- now try to get the full path for the shared Downloads directory
                navigator.Env.getExternalStoragePublicDirectory(dirName,
                    function(fullPath) {
                        console.log("getExternalStoragePublicDirectory(Downloads) returns: " + fullPath);
                    }, function (error) {
                        console.log("getExternalStoragePublicDirectory error: " + error);
                    }
                );
            }
        },
        function (error) {
            console.log("getDirectory error: " + error);
        }
    );
} else {
    console.log("Plugin error: Env plugin not found (is it installed?)");
}

Initial release

09 Nov 16:21
@eb1 eb1
3a811f1
Compare
Choose a tag to compare

This is the initial release of cordova-plugin-env, and contains the following methods:

  • getExternalStorageState()
  • isExternalStorageEmulated()
  • isExternalStorageRemovable()
  • getDirectory(string)

These methods expose the functionality of the Android Environment object.