如何创建应用程序以在没有 root 设备的情况下重启设备?

How to create application to reboot device with not rooted device?

如何在非 root 设备上创建应用程序自动重启设备?

我在 PowerManager 中使用方法重启并获得许可

<uses-permission android:name="android.permission.REBOOT" />

所以出现错误"neither user 10039 nor current process has android.permission.REBOOT"

可能是因为只有系统应用程序和使用与固件签名相同的密钥签名的应用程序才能获得该权限。

请建议我一个更好的方法来创建应用程序自动重启。

您不能从普通的 SDK 应用程序重新启动。只有使用系统固件签名密钥签名的应用程序才能执行此操作。 从这个答案复制,

Programmatically switching off Android phone

您需要系统密钥来为您的应用程序签名。有关详细信息,请参阅此 post;

How to compile Android Application with system permissions

参考和原答案here