Android中使用cmd指令

摘要:Android中使用cmd指令

Android中,透過APK直接使用cmd指令與device溝通


private Process process = null;

String[] cmd1 = { "/system/bin/sh", "-c", "echo hello > /data/temp.txt"};
process = Runtime.getRuntime().exec(cmd1);

String[] cmd2 = { "/system/bin/sh", "-c", "echo hello > /data/temp.txt"};
process = Runtime.getRuntime().exec(cmd2);