用adb command wakeup device
method 1.
adb shell dumpsys power | grep "mScreenOn=true" | xargs -0 test -z && adb shell input keyevent 26

method 2.
adb shell "input keyevent 26"

suspend device
adb shell "input keyevent 6"


user adb command to trigger camera and take picture
Front Camera
Image Capture:
adb shell am start -a android.media.action.IMAGE_CAPTURE --ei android.intent.extras.CAMERA_FACING 1

Back Camera
adb shell am start -a android.media.action.IMAGE_CAPTURE --ei android.intent.extras.CAMERA_FACING 0

Video Capture mode:
Image Capture:
adb shell am start -a android.media.action.VIDEO_CAPTURE --ei android.intent.extras.CAMERA_FACING 1

Back Camera
adb shell am start -a android.media.action.VIDEO_CAPTURE --ei android.intent.extras.CAMERA_FACING 0


Other information

To focus: adb shell "input keyevent KEYCODE_FOCUS"
To take a photo or start/stop recording: adb shell "input keyevent KEYCODE_CAMERA"
Other notes

if the keycode string e.g KEYCODE_CAMERA, does not work, lookup the constant value from the API description. Example: KEYCODE_CAMERA

KEYCODE_CAMERA: Added in API level 1
KEYCODE_CAMERA: Added in API level 1
Constant Value: 27 (0x0000001b)

 

arrow
arrow

    CuteParrot 發表在 痞客邦 留言(0) 人氣()