Issue
I am using camera intent to take a picture in a Service by using following code
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
try {
getApplication().startActivity(intent);
} catch (final ActivityNotFoundException e) {
e.printStackTrace();
} catch (final Exception e) {
e.printStackTrace();
}
It can take the picture; however, every time it shows the preview GUI (having captured picture, Save and Discard buttons). I want to ignore the step, just likes the default capture camera (capture and saving without preview). How could I modify the code? Thank all
Note that: I do not want to use camera2API to make a new app. I want to use the default camera app. Someone said that
"The camera app doesn't give other apps the option to disable the confirmation screen, even though the camera app itself doesn't show the confirmation screen.
Therefore it is not possible for not showing the confirmation screen."
It looks bad new in the past. I am using Android 5.0. Is it possible now?
Solution
I found a good solution using adb shell
adb shell "am start -a android.media.action.STILL_IMAGE_CAMERA" && sleep 1 && adb shell "input keyevent 27"
Notice the action is STILL_IMAGE_CAMERA
Reference Android 4.4 won't allow me to save a picture when captured using adb commands
Answered By - Jame
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.