Detect, request and use superuser permissions on Android devices.
npm install cordova-plugin-rootDetect, request and use superuser permissions on Android devices.
Cordova:
```
cordova plugin add cordova-plugin-root
Ionic:
``
ionic plugin add cordova-plugin-root
``
root.isAvailable(function(res) {
if(res)
console.log("SU access is available and granted");
else
console.log("SU access was denied or is not available");
}, function() {
console.error('An error occoured while checking for SU availability');
});
```
root.run('whoami', function(res) {
console.log(res); //['root']
}, function() {
console.error('An error occoured while executing the command.');
});