Apache Cordova Plugin to Execute Root Commands Android in Smartphone's Operating System Shell.
This is a MODIFIED version of https://github.com/petervojtek/cordova-plugin-shell-exec to be complatible with all commands formats without using arrays.
See Useage
and Examples
Note: All Commands Excutes in Root Mode at the moment, this can be modified later.
- Android
$ cordova plugin add https://github.com/Poyser1911/cordova-plugin-shell-exec.git
window.ShellExec.exec(cmd, callback);
cmd
: String.
callback : function will return a object with two keys - exitStatus
and output
.
Examples: "Quotes Around Path are optional"
var cmd = 'ls';
cmd = 'ls /data';
cmd = 'ls "/data/system\ prefs""; //escaped Whitespace
cmd = 'ls && ls /data && cp "/data/data/com.example.app" "/data/data/com.example.app2" && rm -r -f "/data/data/com.example.app2"'; //Using &&
window.ShellExec.exec(cmd, (res) =>{
alert('exit status: ' + res.exitStatus)
alert('cmd output: ' + res.output)
})