问题
My objective is to automate the process of capturing and saving a picture, with both front and back facing cameras.
I am using a Nexus 5 running Android version 4.4.2 and I have not rooted it.
I use the following commands to open the front and rear facing camera respectively:
>adb shell am start -a android.media.action.IMAGE_CAPTURE --ei android.intent.extras.CAMERA_FACING 1
>adb shell am start -a android.media.action.IMAGE_CAPTURE --ei android.intent.extras.CAMERA_FACING 0
(I found these commands in a previous stackoverflow post-> ADB command to toggle camera modes in android device)
The problem is that while the device is in either of these modes, it will only capture and not save an image when I execute this command:
>adb shell input keyevent KEYCODE_CAMERA
Once I run this command, the photo appears on the screen along with buttons to save, discard or retake the photo. However the save option does not appear to do anything.
I have two specific questions:
1.) Are there any alternative commands that I can use to open either camera?
2.) How can I make sure that the image is not being saved in some unexpected location?
I would really appreciate some help with this issue.
Edit: I don't need to store the picture on my pc, i expected it to be in /sd/card/DCIM/Camera or somewhere else on the phone.
来源:https://stackoverflow.com/questions/22387838/android-4-4-wont-allow-me-to-save-a-picture-when-captured-using-adb-commands