Hello.

Is it possible to programmatically restart a device with Android OS without root? The code found on the English language resource does not work:

PowerManger pm = (PowerManager) getSystemService(Context.POWER_SERVICE); pm.reboot("null") 

The corresponding permission in the manifest has been added.

    3 answers 3

    A reboot cannot be performed by a regular application compiled using a regular SDK. Only applications signed with the system key can request a reboot. System keys are usually located here:

     <root-of-android-source-tree>/build/target/product/security 

    You can use them to sign your application, then the code you give will work.

    • what ??? you're completely wrong - Flippy

    The actual reboot is done via PowerManager.reboot() . Permission required in REBOOT manifest

    Signed as indicated at @ Hi - naturally required.

      In runtime

       Runtime.getRuntime().exec("system/bin/su").write("reboot").getBytes();