Skip to content

Apache Cordova Plugin to Execute Commands in Smartphone's Operating System Shell

License

Notifications You must be signed in to change notification settings

carlo318/cordova-plugin-shell-exec

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-plugin-shell-exec

Apache Cordova Plugin to Execute Commands in Smartphone's Operating System Shell, in SuperUser (su) mode. Rooted device needed.

Supported Platforms

  • Android

Installation

$ cordova plugin add https://github.com/carlo318/cordova-plugin-shell-exec.git

Usage

window.ShellExec.exec(cmd, callback)

cmd must be a single string.

callback function will return a hash with two keys - exitStatus and output.

Example:

window.ShellExec.exec('am start -a android.intent.action.REBOOT', function(res){
  console.log('exit status: ' + res.exitStatus)
  console.log('cmd output: ' + res.output)
})

JS console output:

exit status: 0
cmd output: executed

If command execution fails (e.g. you enter wrong command), you receive exit status 100.

The command is executed as superuser, following this suggestion.

How to Contribute

Use pull request.

About

Apache Cordova Plugin to Execute Commands in Smartphone's Operating System Shell

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 86.7%
  • JavaScript 13.3%