0

I am working one an automation platform which automates the Android test case scenarios. Most of the case I have been able to achieve using simple adb commands. However, I stumbled upon a very simple request which demands sometimes front camera to be open and sometimes back camera to be open.

I did my searches and turns out that I am not able to find out any simple adb command for it(I would love to hear that there is a simple command for that)

Also, I come across some suggestions where people say that we can have more control using Mono but I do not have any experience in Mono at the moment and I am wondering for a simple task like this it would be too much effort to create a Mono project.

Also, some suggested to hack into Camera application source code and have two apps both for front and back camera.

I needed some suggestions on what is best approach for achieving this?

  1. Does any adb command exist?
  2. is creating a Mono project for such a basic thing a good idea?
  3. Can I hack into the code?

Your suggestions would really be appreciated

Lost
  • 12,007
  • 32
  • 121
  • 193

1 Answers1

0

Well, since no on ever answered this question, let me answer it:

The camera API provided by Google on ADb front does not offer much customization so here are the answers to all the three questions:

1.Does any adb command exist? ANS: Yes it does. Please check here: ADB command to toggle camera modes in android device

  1. is creating a Mono project for such a basic thing a good idea? ANS: Technically answer is yes that you can create a Mono project but you don't need to. Download Android SDK and it all you have to do is write minimum Java code to invoke the camera app from your app.

  2. Can I hack into the code? ANS. Don't need to change the source code of camera app. All you have to do is to create your own app which will invoke the camera app and then pass the parameters. Below is the sample code:

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

This 4 liner would do the job for you!!

Community
  • 1
  • 1
Lost
  • 12,007
  • 32
  • 121
  • 193