Android手机关机、重启、快速重启、进recovery的运用
http://bbs.zecoki.com/data/attachment/common/cf/102311q362klb36li21t72.pngAndroid手机关机、重启、进recovery命令以及热重启(快速重启),通常方法是通过手机电源键(关机键)。
其实在程序中并不用那么复杂,直接调用adb命令就可以解决。
但是如果要实现特定场景的关机,热重启就需要ROOT权限了。
安卓没有shutdown的用法,但是有reboot命令,我们可以通过这个命令来解决。
1.关机:
[*]Runtime.getRuntime().exec( new String[] { “/system/bin/su”, “-c”, “reboot -p” });
对应adb shell命令:adb shell su -c "reboot -p"
2.重启:
[*]Runtime.getRuntime().exec( new String[] { “/system/bin/su”, “-c”, “reboot now” });
对应adb shell命令:
adb reboot / adb shell su -c "reboot"
3.重启至recovery:
[*]Runtime.getRuntime().exec( new String[] { “/system/bin/su”, “-c”, “reboot recovery” });
对应adb shell命令:adb reboot recovery / adb shell su -c "reboot recovery"
4.热重启(快速重启):
[*]Runtime.getRuntime().exec( new String[] { “/system/bin/su”, “-c”, “busybox killall system_server” });
对应adb shell命令:
adb shell "kill system_server" / adb shell su -c "busybox killall system_server"
需要用到的工具:adb/fastboot基于最新源码编译修改,兼容其它助手
来源:{http://bbs.zecoki.com/forum-70-1.html}
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
页:
[1]