开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜