Android常用命令

通用命令

设置 wifi 相关命令

Copy
settings put global airplane_mode_on 1 && am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true && sleep 5 && settings put global airplane_mode_on 0 && am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false
cmd wifi start-softap 010101 wpa2 zxcvbnm123
svc wifi enable && cmd wifi connect-network 010101 wpa2 zxcvbnm123
cmd wifi list-networks | grep 010101 | grep wpa2 | awk '{print $1}' | xargs -n 1 cmd wifi forget-network
cmd wifi list-networks | grep test | grep wpa2 | awk '{print $1}' | xargs -n 1 cmd wifi forget-network

whatsapp 命令

查看 whatsapp 对应层级是否有账号

Copy
cat /data/user/0/com.whatsapp/shared_prefs/migration_export.xml
cat /data/user/1/com.whatsapp/shared_prefs/migration_export.xml

cat /data/user/0/com.whatsapp/shared_prefs/com.whatsapp_preferences_light.xml | grep 'registration_jid'
cat /data/user/1/com.whatsapp/shared_prefs/com.whatsapp_preferences_light.xml | grep 'registration_jid'

启动指定层的 whatsapp 应用

Copy
am start --user 0 -n 'com.whatsapp/.Main' -a android.intent.action.MAIN -c android.intent.category.LAUNCHER