-1

Is it possible on an Android terminal tou run a simple script? I'd like to run the following commands

$su
$cd /Downloads
Philidor
  • 40,933
  • 9
  • 84
  • 94
KostasA
  • 4,672
  • 5
  • 19
  • 28

2 Answers2

1

Try something like this:

    try{
    Process su = Runtime.getRuntime().exec("su");
    DataOutputStream outputStream = new DataOutputStream(su.getOutputStream());

    outputStream.writeBytes("screenrecord --time-limit 10 /sdcard/MyVideo.mp4\n");
    outputStream.flush();

    outputStream.writeBytes("exit\n");
    outputStream.flush();
    su.waitFor();
}catch(IOException e){
    throw new Exception(e);
}catch(InterruptedException e){
    throw new Exception(e);
}

read this SO question also.

Community
  • 1
  • 1
droidev
  • 7,104
  • 11
  • 60
  • 93
0

Yes, search the app store for terminal emulator.

OneCricketeer
  • 151,199
  • 17
  • 111
  • 216