Enable Device Debug
- Enable developer mode on your Android device
- Settings ⇒ System ⇒ About Phone ⇒ Tap "Build number" over 7 times and quickly
- Then you will see "You are already developer"
- Enable debugging
- Go to "Developer Options" ⇒ Enable "ADB debugging"
- Connect Android phone to your Windows PC, then you will see a pop-up ( some phone will not show pop-up, please check notification center)
- Choose "Transfer files"
adb Setup
Windows
- Download adb package for windows. https://developer.android.com/studio/releases/platform-tools.html
- Unzip the package, then put it to any path
cd C:\{adb folder path}
Mac
- Download adb package for mac. https://developer.android.com/studio/releases/platform-tools.html
- Install adb
- Open terminal
Check installation success
- Type
adb
- If you can see below message, means adb is able to use
Android Debug Bridge version 1.0.40
Version 4986621
Installed as C:\{adb folder path}\adb\adb.exe
global options:
-a listen on all network interfaces, not just localhost
-d use USB device (error if multiple devices connected)
-e use TCP/IP device (error if multiple TCP/IP devices available)
-s SERIAL use device with given serial (overrides $ANDROID_SERIAL)
-t ID use device with given transport id
-H name of adb server host [default=localhost]
-P port of adb server [default=5037]
-L SOCKET listen on given socket for adb server [default=tcp:localhost:5037]
adb command
- Connect your Android phone to PC/MAC, then type
adb devices
If you see below message, means your Android phone already connected to PC, and able to use adb command
List of devices attached
35PDU18712000000 device
- Send text to device
adb shell input text "textttt"
- Send key to device.
You can use key name or key code. eg: TAB(61), HOME(3), ENTER(66)
https://developer.android.com/reference/android/view/KeyEvent
adb shell input keyevent TAB
adb shell input keyevent 61
- Log ( logcat) https://developer.android.com/studio/command-line/logcat