Example usage for android.os PowerManager reboot

List of usage examples for android.os PowerManager reboot

Introduction

In this page you can find the example usage for android.os PowerManager reboot.

Prototype

public void reboot(String reason) 

Source Link

Document

Reboot the device.

Usage

From source file:Main.java

public static void rebootRecovery(Context context) {
    Log.w(TAG, "!!! REBOOT RECOVERY !!!");
    PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    pm.reboot("recovery");
}

From source file:org.wso2.emm.system.service.EMMSystemService.java

/**
 * Rebooting the device.//from  w ww .  j  a  v  a 2 s. com
 */
private void rebootDevice() {
    Log.i(TAG, "Reboot request initiated by admin.");
    try {
        Thread.sleep(5000);
        PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
        powerManager.reboot(null);
    } catch (InterruptedException e) {
        Log.e(TAG, "Reboot initiating thread interrupted." + e);
    }
}