ADB commands in code
Is there a way to run adb commands like
adb get-state
in the code I write in eclipse
For e.g.
public void onCreate(Bundle savedInstanceState) {
su开发者_运维百科per.onCreate(savedInstanceState);
setContentView(R.layout.main);
testADB();
}
and in testADB()
run some adb commands?
Adithya , I believe you are trying to drop adb commands programmatically.Check this link.
Not literally, due to permissions and the security model. The usb adb daemon on a consumer phone runs with slightly higher privileges than ordinary applications, so accepting commands from them would be a security hole.
However as others have pointed out, there may be alternative means to obtain some kinds of data.
You can probably use some of the classes in ddmlib.jar for that.
精彩评论