【发布时间】:2019-12-28 11:15:57
【问题描述】:
我想用我的应用重启我的手机,但它需要root。
有没有办法不用root?
我的代码:
try {
Runtime.getRuntime().exec(new String[]{"su","-c","reboot now"});
} catch (IOException e) {
e.printStackTrace();
}
编辑:我听说我们可以在没有root用户的情况下重启手机
'设备策略管理器' 。
但我看不懂官方文档???? ,如果有人知道,请留下演示代码。
【问题讨论】:
-
这能回答你的问题吗? Restart android device programmatically
-
答案就在您的问题中:否。
Runtime.getRuntime().exec(new String[]{"su","-c","reboot now"});你必须运行 su,它只有在你的设备 root 时才能访问。 -
我之前尝试过您给定的链接,但它不适用于无根手机。
标签: android reboot programmatically