简体   繁体   English

如何知道android手机何时连接adb

[英]How to know when android phone connected adb

I need do something when phone connected adb.How to know this action?手机连接adb时我需要做一些事情。如何知道这个动作?

I think maybe have one broadcast,but I can't find it.我想也许有一个广播,但我找不到它。

my mean is in phone know connected state,not pc我的意思是在电话知道连接状态,而不是电脑

you can use adb devices您可以使用adb devices

Android Debug Bridge Android 调试桥

run 'adb devices' in command line client, if your phone has been connected adb, it will show you like this:在命令行客户端运行'adb devices',如果你的手机已经连接了adb,它会显示如下:

List of devices attached 
0163C00D17036020    device

note: if you have not configed the 'adb' environment path, cd to android-sdk/platform-tools/, then run it.注意:如果你还没有配置'adb'环境路径,cd到android-sdk/platform-tools/,然后运行它。

Run跑步

adb devices -l

It will show you more information它将向您显示更多信息

for automation you can use from adb shell.对于自动化,您可以从 adb shell 使用。 if return a error you can underestand that a device connect to your adb.如果返回错误,您可以理解设备连接到您的 adb。 for example:例如:

click_me点击我

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM