我想知道Cordova或Cordova的任何插件是否允许我在Android shell中执行命令?类似于在连接到手机的台式机上执行 adb shell myCoolBinary -doThisStuff 。
I'm wondering if Cordova or any plugin for Cordova enables me to execute a command in the android shell? Similar to doing adb shell myCoolBinary -doThisStuff on a desktop machine connected to the phone.
教程如何使用Cordova cli桌面应用程序,这绝对不是我在寻找。我想在手机上执行命令。
Googling for this only returns tutorials for how to use the Cordova cli desktop application, which absolutely NOT what I'm looking for. I want to execute commands ON the phone.
推荐答案我最终编写了自己的插件。 我主要把它从另一个问题,是关于从你的Android应用程序执行根shell执行。
I ended up writing my own plugin. I mostly put it together from another question that was about doing root shell executes from within your android app. I just adapted it to cordova.
我没有时间做这个好的,所以这里是一个提示: gist.github/PTS93/d78ee885ee0c2f74892434008a953f8c
I don't have the time to make this nice so here is a gist: gist.github/PTS93/d78ee885ee0c2f74892434008a953f8c
只需使用此插件模板的文件替换文件: github / don / cordova-plugin-hello
Just replace the files with the files from this plugin template: github/don/cordova-plugin-hello
您可以在cordova应用程式中呼叫:
You can then in your cordova app call this:
shell.execute("your shell command", success, failure);更多推荐
在Android上执行shell命令
发布评论