How to power on/off the Android device


Can any one tell how to power on/off the android devices.

You can try using adb commands:

To power off the device:
adb shell reboot -p

To restart the device
adb reboot -p

Some advanced extra:
Run it procrammatically:

    public static String command(String command){
      //Formatting ADB Command
      if(command.startsWith("adb")) command = command.replace("adb ", "YOURPATH/platform-tools/adb ");
      else throw new RuntimeException("This method is designed to run ADB commands only!");
      sysout("Formatted ADB Command: "+command);

      String output = runCommand(command); //see runCommand below
      MyLogger.log.debug("Output of the ADB Command: "+output);
      if(output == null) return "";
      else return output.trim();

    public static String runCommand(String command){
      String output = null;
          Scanner scanner = new 
          if(scanner.hasNext()) output =;
      }catch (IOException e){
         throw new RuntimeException(e.getMessage());
      return output;

using this 2 above methods will make using adb commands easy and efficient.
command(“adb shell reboot -p”);
command(“adb reboot -p”);

1 Like

Thank you so much. It worked for me :slightly_smiling_face: