1

My code (to test the camera functionality in the app)

((AndroidDriver) driver).pressKeyCode(27);

or

((AndroidDriver) driver).pressKeyCode(AndroidKeyCode.KEYCODE_CAMERA);

doesn't work to take a picture in the app. ( I only have it on the Nexus 5 and Pixel Phone)

When I try cmd adb shell input keyevent 27 in the app, also no reaction. When I try the same cmd in the camera app, it does take a picture.

I do have the same when i try the cmd when i am in Facebook app and try to take a picture.

Has someone seen this behavior before?

theAlse
  • 5,577
  • 11
  • 68
  • 110
DDB
  • 33
  • 7
  • 1
    There is no requirement for camera apps to listen for the `KEYCODE_CAMERA` event. This is particularly true for camera apps that ship with devices that do not have a hardware CAMERA button. Why are you trying to start the camera app this way, rather than via starting an `ACTION_IMAGE_CAPTURE` activity, or something like that? – CommonsWare Feb 09 '17 at 14:49
  • hi, I'am talking about a testscript with java. I haven't encountered your mentioned action yet. Does this work with the appium webdriver ? – DDB Feb 10 '17 at 08:17
  • Sorry, I missed the `appium` tag, so `ACTION_IMAGE_CAPTURE` is not relevant. However, my point about `KEYCODE_CAMERA` is still relevant: do not assume that this will take a picture. – CommonsWare Feb 10 '17 at 13:27
  • format and text – theAlse Feb 11 '17 at 19:14

0 Answers0