I need to make a keep a command running in background even if the app is in background, but I didn't find any way. I'm kind new in android developing, So...
public void RunAsRoot(String[] cmds) throws IOException {
Process p = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(p.getOutputStream());
for (String tmpCmd : cmds) {
os.writeBytes(tmpCmd + "\n");
}
os.writeBytes("exit\n");
os.flush();
}
RunAsRoot(anycommand);
public void onPause() {
super.onPause();
}