0

这是一个很长的故事,但我试图调用 ShutdownThread 目录来重新启动手机,由于某种原因它不喜欢我的上下文等,因为它给了我这个错误......任何帮助将不胜感激......

.NativeStart.main(Native Method)
     [exec] 05-23 16:32:36.354  5573  5573 W System.err: Caused by: android.view
.WindowManager$BadTokenException: Unable to add window android.view.ViewRoot$W@4
5985ae0 -- permission denied for this window type
     [exec] 05-23 16:32:36.362  5573  5573 W System.err:        at android.view.


/**
 * Request a clean shutdown, waiting for subsystems to clean up their
 * state etc.  Must be called from a Looper thread in which its UI
 * is shown.
 *
 * @param context Context used to display the shutdown progress dialog.
 * @param reason code to pass to the kernel (e.g. "recovery"), or null.
 * @param confirm true if user confirmation is needed before shutting down.
 */
public static void reboot(final Context context, String reason, boolean confirm) {
    mReboot = true;
    mRebootReason = reason;
    shutdown(context, confirm);
}
4

2 回答 2

0

在调用您reboot()尝试给予getParent()上下文参数并查看时。

于 2011-05-24T05:41:35.650 回答
0

尝试在AndroidManifest中添加以下权限。万一你没有。

android.permission.SYSTEM_ALERT_WINDOW

于 2013-07-08T08:11:41.580 回答