Alex Rivera | Logout

Is it possible to execute adb commands through my android app?

Asked 2012-11-14T15:28:59.780
43

Can anyone say, whether adb commands can be executed through my android application. If it is possible to execute, how it can be implemented?

Edit
Report

1 Answer

32

You can do it with this:

Process process = Runtime.getRuntime().exec("your command");
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));

Don't forget to surround it with a try and catch statement.

Edit:

@Phix is right, ProcessBuilder would be better to use.

answered 2012-11-14T15:32:02.483

Your Answer