【问题标题】:Is there anyway to reboot a device programmatically without root?无论如何,是否可以在没有 root 的情况下以编程方式重新启动设备?
【发布时间】: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


【解决方案1】:

据我所知,您需要 root 权限才能实现此行为。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-03
    • 2011-03-09
    • 1970-01-01
    相关资源
    最近更新 更多