ADB Commands in Code

Is there any way to run adb commands like

adb get-state

in the code I'm writing in eclipse

For example,

public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); testADB(); } 

and in testADB() execute some adb commands?

+3
source share
3 answers

Aditya, I believe that you are trying to cancel adb commands programmatically. Check out this link.

+3
source

Not literally due to permissions and security model. The usb adb daemon on a consumer phone works with slightly higher privileges than regular applications, so receiving commands from them will be a security hole.

However, as others have pointed out, there may be alternative methods for obtaining certain types of data.

+2
source

You can use some of the classes in ddmlib.jar for this.

0
source

All Articles