简体   繁体   中英

How to know when android phone connected adb

I need do something when phone connected adb.How to know this action?

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

Android Debug Bridge

run 'adb devices' in command line client, if your phone has been connected adb, it will show you like this:

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.

Run

adb devices -l

It will show you more information

for automation you can use from adb shell. if return a error you can underestand that a device connect to your adb. for example:

click_me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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