0

I am trying to figure out what is the command to load the camera app in different modes like following:

  1. Toggle between camera and video cam corder mode
  2. Toggle between front and back camera

I have used the following command to launch the camera applicaiton

adb shell am start -a android.intent.action.MAIN -n com.android.gallery3d/com.android.camera.CameraLauncher

which does launch the camera app successfully but I do no know how to toggle modes. Is there any wiki on all the different commands of ADB? the ADB documentation does not seem to talk about this.

Any ideas?

Lost
  • 12,007
  • 32
  • 121
  • 193

3 Answers3

6

You can pass an Extra with an integer value using the --ei flag to the am start command

Front Camera

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
Chris Stratton
  • 39,853
  • 6
  • 84
  • 117
  • Thank you so much for the answer. However if it works for front and back camera options. why it does nto work when I try to trun flash off by android.intent.extras.FLASH_MODE_OFF 1? I have a similar question here : http://stackoverflow.com/questions/19667094/intent-does-not-set-the-camera-parameters can you help with that? – Lost Oct 29 '13 at 20:45
0

You can use following though:

Intent action = new Intent("android.media.action.IMAGE_CAPTURE");  
        action.putExtra("android.intent.extras.CAMERA_FACING", 1);

You can use adb command "am start" . Please read following: How to run a specific Android app using Terminal?

Community
  • 1
  • 1
Lost
  • 12,007
  • 32
  • 121
  • 193
  • Untrue - if you can do this with a programmatic Intent, you can send that same Intent using ADB commands - you were on the right track in your question, you just need to fill in the fields. – Chris Stratton Oct 29 '13 at 19:56
  • I did not come across any example where they allow passng parameters to an intent using adb.. – Lost Oct 29 '13 at 20:04
  • I think you are referring to something like following:http://stackoverflow.com/questions/5494764/how-to-run-a-specific-android-app-using-terminal looks lik eit is do-able so I am changing my answer. – Lost Oct 29 '13 at 20:29
0

For KK:

adb shell am start -a android.media.action.STILL_IMAGE_CAMERA --ei android.intent.extras.CAMERA_FACING 1

Change the id 0 or 1 for front and back camera.