0

I am using https://github.com/googlesamples/android-Camera2Basic project to create my own app, But when I added the code to control flash(on, off, auto).

private void setAutoFlash(CaptureRequest.Builder requestBuilder) {
    if (mFlashSupported) {

        if(FLASH_STATUS == 0) {
            requestBuilder.set(CaptureRequest.CONTROL_AE_MODE,
                    CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH);
        }
        else if(FLASH_STATUS == 1){
            requestBuilder.set(CaptureRequest.FLASH_MODE,
                    CaptureRequest.FLASH_MODE_SINGLE);
        }else if (FLASH_STATUS == 2){
            requestBuilder.set(CaptureRequest.FLASH_MODE,
                    CaptureRequest.FLASH_MODE_OFF);
        }

    }
}

It is behaving differently on different devices. Is there any solution which will behave consistant on every device?

Root
  • 11
  • 3
  • take a look at this project: https://github.com/almalence/OpenCamera It implements almost every aspect of camera2 – Hibbem Apr 26 '17 at 09:08
  • @Reyske I have this problem now too. Can you give me please a link to file with code. Because I use xamarin and don't know java project. Thanks – Dev Apr 19 '18 at 09:27

0 Answers0