Pavan Kulkarni
Pavan Kulkarni

Reputation: 476

How to scan a QR code in live mode in Blackberry OS 5

Google Zxing expects an image. Can someone point me to how to make it work cleanly for live scanning (i.e. user points the device at a QR code and the scan happens; user does not have to take an image)? I've come across the following two aspects:

  1. Some threads suggested to use a timer and event injection to continuously take pictures - but this approach may incur too much overhead on the device
  2. Some other threads have suggested that live scanning is only possible from OS 6 and above as RIM doesn't expose those APIs in OS versions below 6 - but I'm unable to find any official statement to this effect.

Other than Zxing are any other libraries to achieve the same for BB OS 5?

Thanks in advance

Upvotes: 5

Views: 852

Answers (2)

Mister Smith
Mister Smith

Reputation: 28178

To use "live scanning" feature you need to use the Barcode API, which is a layer on top of ZXing only available in OS 6.0.

Here you have the official how to on Barcode API. In 5.0, you'll have to implement a custom mechanism based on VideoControl. To implement a workaround, you could take snapshots periodically and try to decode them, or capture frames somehow from the video feed.
As the other answer says, in devices without autofocus, the FocusControl will not work. In this case I suggest you to apply some zoom instead (using ZoomControl class). This forces the user to move the blackberry away from the QRCode to be able to see it on the screen, thus increasing the definition of the captured image, which in turn increases the chances of detecting a barcode.

Upvotes: 1

donturner
donturner

Reputation: 19146

This library allows you to do live scanning on OS5. It works as an interface to the ZXing library.

Be warned, however that on OS5 devices FocusControl is not fully implemented so scanning barcodes up close will be problematic. The workaround is to use VideoControl.getSnapshot() which is the only way to force the camera to focus.

Upvotes: 4

Related Questions