1. 獲取內部版本號: adb shell getprop ro.build.display.innerver
2. 獲取按鍵值: adb shell getevent
3. 獲取apk信息: adb shell dumpsys package 包名 ->info.txt
4. 獲取應用包名:adb shell dumpsys window windows | grep mFocusedApp ?或者 adb shell dumpsys window windows | findstr mFocusedApp
5. 打開WiFi設置界面:adb shell am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings
6. 打開熱點設置界面:adb shell am start -n com.android.settings/.TetherSettings
7. 查詢藍牙是否開啟:
adb shell settings get global bluetooth_on ? 返回結果0代表關閉,1代表開啟
adb shell dumpsys bluetooth_manager | findstr enabled ? ? 返回結果是true或者false,說明開啟或關閉
8. 查詢WiFi是否開啟:adb shell settings get global wifi_on ? ? 返回結果0代表關閉,1代表開啟?
9. 查詢藍牙地址:adb shell settings get secure bluetooth_address
10. 查詢WiFi地址:adb shell cat /sys/class/net/wlan0/address
11. 開啟WiFi:adb shell svc wifi enable
12. 關閉WiFi:adb shell svc wifi disable
13. 打開藍牙設置界面:adb shell am start -a android.settings.BLUETOOTH_SETTINGS
14. 獲取手機休眠時間:adb shell settings get system screen_off_timeout
15. 更改手機休眠時間:adb shell settings put system screen_off_timeout 600000(10分鐘)
16. 獲取系統默認輸入法:adb shell settings get secure default_input_method
17. 獲取手機是否為自動亮度:adb shell settings get system screen_brightness_mode ?(0代表非自動,1代表為自動)
18. 設置手機為自動調整亮度:adb shell settings put system screen_brightness_mode 1 ? ?
19. 獲取手機當前亮度:adb shell settings get system screen_brightness
20. 設置手機亮度(0-255):adb shell settings put system screen_brightness 350
21. 打開定位設置界面:adb shell am start -a android.settings.LOCATION_SOURCE_SETTINGS
22. 開啟定位:adb shell settings put secure location_providers_allowed +gps
23. 關閉定位:adb shell settings put secure location_providers_allowed -gps
24. 查看定位方式:adb shell settings get secure location_providers_allowed ?(前提是位置信息開啟)
25. 撥打電話:adb shell am start -a android.intent.action.CALL tel:8888888888888
26. 發送短信:adb shell am start -a android.intent.action.SENDTO -d sms:10086(發送目的號碼) --es sms_body "hello"(短信內容) --ez exit_on_sent true?
27. 獲取應用包名:adb shell dumpsys window windows | findstr ?mFocusedApp?
28. 清除應用數據與緩存: adb shell pm clear cn.com.test.mobile
29. 啟動應用: adb shell am start -n cn.com.test.mobile/.ui.SplashActivity?
30. 停止應用:adb shell am force-stop cn.com.test.mobile
31. 飛行模式:adb shell settings set global airplane_mode_on ? (0==關閉,1==開啟)
32. 開啟飛行模式:adb shell settings put global airplane_mode_on 1
33. 手機震動測試(前提手機root):①adb shell ②echo '3000'>/sys/devices/virtual/timed_output/vibrator/enable
34. 向上滑:adb shell input touchscreen swipe 930 880 930 380?
35. 向下滑:adb shell input touchscreen swipe 930 380 930 880
36. 向右滑:adb shell input touchscreen swipe 330 880 930 880?
37. 向左滑:adb shell input touchscreen swipe 930 880 330 880
38. 模擬鼠標點擊操作:adb shell input mouse tap 100 500
39. 長按:adb shell input swipe startX startY startX startY 500
40. 滑動解鎖:adb shell input swipe 300 1000 300 500
41. 冷啟動app:adb shell am start -W -n package/activity
42. 熱啟動:①停止app: adb shell input keyevent 3 ?②adb shell am start -W -n package/activity
43. 查看內存占用情況:adb -s 設備號 shell top -m 進程數量 -n 數據的刷新次數 -s 按哪列進行排序 -d 刷新時間間隔(默認5秒)
44. 切換手機電池為非充電狀態: adb shell dumpsys battery set status 1
45. 改變手機電量: adb shell dumpsys battery set level 58
46. 獲取當前電量:adb shell cat /sys/class/power_supply/battery/capacity
47. 手機截屏:adb shell /system/bin/screencap -p /sdcard/screenshot.png
48. 錄制屏幕:adb shell screenrecord --time-limit 10 /sdcard/demo.mp4
49. 獲取手機型號:adb shell getprop ro.product.model
50. 獲取電池信息:adb shell dumpsys battery ?
51. 獲取屏幕分辨率:adb shell wm size
52. 獲取屏幕密度:adb shell wm density
53. 顯示屏參數:adb shell dumpsys window displays
54. 獲取手機IP地址:adb shell ifconfig | findstr Mask
55. 查看WiFi局域網地址:adb shell ifconfig wlan0
56. 顯示區域位置:adb shell wm overscan 0,0,0,200 ?(四個數字分別表示距離左、上、右、下邊緣的留白像素,以上命令表示將屏幕底部 200px 留白)
57. 恢復原顯示區域命令:adb shell wm overscan reset
58. 獲取USB調試模式:adb shell settings get global adb_enabled
59. 關閉USB調試模式:adb shell settings put global adb_enabled 0
60. 狀態欄和導航欄的顯示隱藏:
adb shell settings put global policy_control <key-values>
<key-values> 可由如下幾種鍵及其對應的值組成,格式為 <key1>=<value1>:<key2>=<value2>。
? immersive.full----------同時隱藏
? immersive.status----------隱藏狀態欄
? immersive.navigation----------隱藏導航欄
? immersive.preconfirms----------?
這些鍵對應的值可則如下值用逗號組合:
? apps----------所有應用
? *----------所有界面
? packagename----------指定應用
?-packagename----------排除指定應用
例如:
adb shell settings put global policy_control immersive.full=*
表示設置在所有界面下都同時隱藏狀態欄和導航欄。
adb shell settings put global policy_control immersive.status=com.package1,com.package2:immersive.navigation=apps,-com.package3
表示設置在包名為 com.package1 和 com.package2 的應用里隱藏狀態欄,在除了包名為 com.package3 的所有應用里隱藏導航欄。
61. 打開網頁: adb shell am start -a android.intent.action.VIEW -d http://www.baidu.com
62. 查看通信日志 :adb logcat -b radio (常用于查看詳細的通話狀態)
63. 獲取界面控件:adb uiautomator dump
64. 列出輸入法:adb shell ime list -s?
65. 永不休眠:adb shell settings put system screen_off_timeout 2147483647
66. 關閉\打開自動旋轉:adb shell settings put system accelerometer_rotation 0\1
?