运行shell命令在Android上的根? [英] Run a shell command as root on android?
问题描述
我认为这将是很酷打开时,我的应用程序需要用户关注的硬件按钮的LED灯,当屏幕变为空白,用户可以得到一个指标。事实证明,这需要root访问权限(回声1> /系统/班/ LED灯/键盘背光/亮度)。我发现栈(http://muzikant-android.blogspot.com/2011/02/how-to-get-root-access-and-execute.html)的链接测试对于root访问权限,但失败的一类在我的Nexus-S。
I thought it would be cool to turn the hardware button lights on when my application needs user attention so the user could get an indicator when the screen is blanked. As it turns out, this requires root access (echo 1 > /system/class/leds/keyboard-backlight/brightness). I found a link on Stack (http://muzikant-android.blogspot.com/2011/02/how-to-get-root-access-and-execute.html) to a class which tests for root access but it fails on my Nexus-S.
有没有一种方法,而不必以root设备运行shell命令以root?
Is there a way to run shell commands as root without having to root the device?
感谢
编辑:这是我从logcat中发现了错误
12月11日至15日:34:19.889:D /根(2029):Root权限被拒绝[java.io.IOException异常]:错误运行EXEC()。命令:[苏]工作目录:空环境:空
this is the error I'm getting from logcat 11-15 12:34:19.889: D/ROOT(2029): Root access rejected [java.io.IOException] : Error running exec(). Command: [su] Working Directory: null Environment: null
推荐答案
如果你的手机有root权限,你可以使用火过程与Runtime类.. shell脚本
If your phone has root access then you can fire shell scripts using Process and Runtime class..
这篇关于运行shell命令在Android上的根?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!