这是我在日常开发中积累的非常实用的一些技巧。分享出来,快来收藏吧
- 通过shell拉起应用
拉起应用: adb shell am start -n com.example.app/com.example.app.LauncherActivity
强制关闭: adb shell am force-stop com.example.app
- 隐藏系统Toast:
appops set android TOAST_WINDOW deny
appops set com.android.systemui TOAST_WINDOW deny
- 找出神秘Toast出处:
adb shell uiautomator events
- 打开关闭usb adb :
settings put global adb_enabled 0
settings put global adb_enabled 1
- Adb端口转发
adb reverse tcp:8080 tcp:8080
adb forward tcp:8080 tcp:8080
- 设置屏幕亮度
settings put system screen_brightness 0;//0-255
- 列出可设置项
adb shell settings list system
adb shell settings list global
adb shell settings list secure
- 命令行方式发送广播
am broadcast -a com.example.app.ACTION --es k v
- shell命令设置默认输入法
$ adb shell ime
usage: ime list [-a] [-s]
ime enable ID
ime disable ID
ime set ID