petervojtek / cordova-plugin-shell-exec Goto Github PK
View Code? Open in Web Editor NEWApache Cordova Plugin to Execute Commands in Smartphone's Operating System Shell
License: Apache License 2.0
Apache Cordova Plugin to Execute Commands in Smartphone's Operating System Shell
License: Apache License 2.0
Hi,
Would it be possible to also add a react native module wrapper for this code, so shell commands can be called from there?
I've just started using the plugin and tried something basic:
window.ShellExec.exec('ls /storage', function(res){
console.log('exit status: ' + res.exitStatus)
console.log('cmd output: ' + res.output)
})
but I get an IO error:
java.io.IOException: Error running exec(). Command: [ls /storage] Working Directory: null Environment: null
I've added these permissions in platforms/android/AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
but I'm not sure what else I need to setup run the above command.
(The device I'm currently using is not rooted)
Any tips on how I should get past this error ?
Thank you,
George
Hi,
This plugin sound very interesting.
Can it run a shell script inside the app?
Some operations are easy to do with a shell script but complex in JavaScript.
The idea is to write part of app using sh or bash, and the rest in html5.
There is an example ?
Regards
MaX
Hi,
When I use a command like 'uptime' or 'pwd' or ['uptime'] or ['pwd'], it simply works.
If I use something like 'tar' I expect the normal output on how to use it, but I see nothing. No output at all.
Commands like 'ls -l' or ['ls -l'] or ['ls', '-l'] or 'mkdir -p /sdcard/tmp' or ['mkdir -p /sdcard/tmp'] or ['mkdir', '-p', '/sdcard/JT'] or ['sh', '-c', 'mkdir -p /sdcard/tmp'] simply don't work.
What is wrong or what I do wrong?
Edit: Even though it is a shell command doing "things" and not the apk itself, I also added the following 2 lines to my Androidmanifest.xml and recompiled, signed and zip-aligned.
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
This didn't help either.
Geliştirici seçenekleri açık değilse kabuk erişimine kod yazılabilir mi ?
uygulamamızı yükleyenler tek tuşa dokunum istediği ayarları kabuğa gönderebilir mi ?
Hi
I'm tring to read (and then write) the sdcard using:
<script>
function lsfuncion() {
window.ShellExec.exec('ls /sdcard/', function(res){
console.log('exit status: ' + res.exitStatus)
console.log('cmd output: ' + res.output)
// alert(res.output)
var div = document.getElementById("COMMAND");
div.textContent = res.output;
var text = div.textContent;
})
}
</script>
<div id="wrapper">
<p><a href="#" class="btn" onclick="lsfuncion();">$ ls /sdcard</a></p>
</div>
<div id="COMMAND"></div>
but the result is: "Process has not yet termintated: 3577"
...that sound like the plugin can not read an external device mounted in the filesystem.
no problem if we try to read de root /
Can have a look for it, please?
Can the plugin be used to start an external APK, or it can only run OS commands ?
Thanks for any info.
Mario
It seem that the package is on npm like other plugins so you shoud be able to use:
cordova plugin add cordova-plugin-shell-exec
it's shorter and you probably can change version, so why don't put this into README
HI,
I had run 'apt-get install nodejs ' from this plugin. I got status code =100 and out put is empty. But node is not installed in mobile. But i run this command through terminal ,Nodejs installed successfully . Kindly help for this issue asap
I am running this command from my computer
$ adb shell input keyboard 26
and it's working perfectly ( turning the phone off ).
but when I try to execute this command using the plugin :
$ input keyboard 26
it doesn't work.
Thank you in Advance
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.