有用的 Android/iOS 命令

Activities:

Find activity:

adb shell dumpsys package | grep -i "enter package name" | grep Activity

Run/Launch app activity:

adb shell am start -W -n packageName/xx.MainActivity -S

Show current activity:

adb shell dumpsys window windows | grep -E 'mCurrentFocus'


Reboot phone:

iOS: idevicediagnostics -u udid restart

Android: adb -s udid reboot

List all installed apps:

iOS:   ideviceinstaller -u udid -l

Android: adb shell 'pm list packages -f'  

better one is:  

adb shell "pm list packages -f" | cut -f 2 -d "="

Get sms

adb shell dumpsys activity broadcasts  | grep senderName= | awk -F'message= | senderName= | xxx=''{print $2}' | grep -oE'[0-9]{4,}'

Extract app package

adb shell pm list packages

adb shell pm path com.example.someapp

adb pull /data/app/com.example.someapp-2.apkpath/to/desired/destination

Get device properties

adb shell getprop | grep "model\|version.sdk\|manufacturer\|hardware\|platform\|revision\|serialno\|product.name\|brand"

Disable android window animation

#For Android JellyBean and newer device

adb shell content update --uri content://settings/system --bind value:s:0.0 --where'name="window_animation_scale"'

adb shell content update --uri content://settings/system --bind value:s:0.0 --where'name="transition_animation_scale"'

adb shell content update --uri content://settings/system --bind value:s:0.0 --where'name="animator_duration_scale"'

#For Android ICS and older device

adb shell"echo\"update system set value=0.0 where name='window_animation_scale';\"| sqlite3 /data/data/com.android.providers.settings/databases/settings.db"

adb shell"echo\"update system set value=0.0 where name='transition_animation_scale';\"| sqlite3 /data/data/com.android.providers.settings/databases/settings.db"

adb shell settings put global window_animation_scale 0 &

adb shell settings put global transition_animation_scale 0 &

adb shell settings put global animator_duration_scale 0 &

Unlock phone:

/Users/ymin/Library/Android/sdk/platform-tools/adb -P 5037 -s #phoneID shell am start -W -n io.appium.unlock/.Unlock -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000

Kill app:

adb shell am force-stop com.my.app.package

你可能感兴趣的:(有用的 Android/iOS 命令)