reboot Device via shell - Android Android OS

Android examples for Android OS:Shell

Description

reboot Device via shell

Demo Code


//package com.java2s;
import java.io.DataOutputStream;

public class Main {
    static public void rebootDevice() {
        try {/*w w w .  j av  a2s. c o  m*/
            Process process = Runtime.getRuntime().exec("su");
            DataOutputStream os = new DataOutputStream(
                    process.getOutputStream());
            os.writeBytes("reboot \n");
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
}

Related Tutorials