From 5ca1e07d9ee0bf7ba765d80365a25ca3aa4fea64 Mon Sep 17 00:00:00 2001 From: Woon Tien Jing Date: Sat, 6 Dec 2014 17:32:54 +0800 Subject: [PATCH] Documented Android flash:"on" quirk after finding out that setting focus mode to CONTINUOUS_PICTURE or CONTINUOUS_VIDEO actually gave poorer results (flash only turned on during the first autofocus attempt, if at all - may be device dependent) --- README.md | 7 ++++++- android/ZBarScannerActivity.java | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fb17160..75a07c2 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Arguments: text_title: "OPTIONAL Title Text - default = 'Scan QR Code'", // Android only text_instructions: "OPTIONAL Instruction Text - default = 'Please point your camera at the QR code.'", // Android only camera: "front" || "back" // defaults to "back" - flash: "on" || "off" || "auto" // defaults to "auto" + flash: "on" || "off" || "auto" // defaults to "auto". See Quirks } ``` @@ -43,3 +43,8 @@ Status: - Android: DONE - iOS: DONE + +Quirks: + +- __Android__: Flash "on" may cause the flash to alternate between on and off + at about a half second/one second interval, instead of making it stay on... diff --git a/android/ZBarScannerActivity.java b/android/ZBarScannerActivity.java index c84629f..b04fa97 100644 --- a/android/ZBarScannerActivity.java +++ b/android/ZBarScannerActivity.java @@ -342,7 +342,11 @@ implements SurfaceHolder.Callback { camera.setPreviewDisplay(holder); camera.setPreviewCallback(previewCb); camera.startPreview(); - camera.autoFocus(autoFocusCb); + camera.autoFocus(autoFocusCb); // We are not using any of the + // continuous autofocus modes as that does not seem to work + // well with flash setting of "on"... At least with this + // simple and stupid focus method, we get to turn the flash + // on during autofocus. } catch (IOException e) { die("Could not start camera preview: " + e.getMessage()); }