ADB command to toggle camera modes in android device

匿名 (未验证) 提交于 2019-12-03 02:29:01

问题:

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?

回答1:

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 


回答2:

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?



回答3:

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!