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?