qrscanner.show()


Type Function

Return value none

See also qrscanner.*


Overview

Opens the scanner view.

Syntax

qrscanner.show(params)

params required

Table. Contains parameters for the call — see the next section for details.

Parameter Reference

The params table includes parameters for the call.

topbar optional

Table. Topbar options, see below for details.

useFrontCamera optional

Boolean. Set to true to use the front camera if it’s available. If it’s not available, the rear camera will be used.

filter optional

String. Filter regular expression. If present, all codes will be tested against the provided regular expression for a match. Only a matched code will be captured. This option can greatly reduce false triggerings or it can be used to scan only certain codes. For example to match a web URL you can use '^https?://.*'.

symbols optional

Array of strings. A list of all types of visual codes to search. Default is 'qr'. See below for all supported types.

mask optional

Table. Mask options. Mask is used to limit the scanning area of a camera. See below for details.

overlays optional

Table. Specify what images to use as camera overlays. They are displayed on top of the camera feed. There can be three overlays as key/value pairs: searching, mismatch and found. Searching is the default mode, mismatch is used when a code is recognised, but doesn’t match the filter, and found overlay is used when the scanning is successful. Each overlay is an overlay table, see below for details.

listener optional

Listener. Listener which receives the show event when the scanning has been completed, either successfully or with an error.

topbar table

Contains options for displaying the topbar of the scanner view.

text optional

String. Title text.

fontSize optional ~(Android)~

Float. Relative font size of the title text, e.g. 0.5 is half the normal size. Default is 1.0. On iOS the text size is automatically adjusted to fit in the topbar.

color optional

Array of floats. RGB color table for the text color. Default is {1.0, 1.0, 1.0}.

backgroundColor optional

Array of floats. RGB color table for the topbar background color. Default is {0.0, 0.0, 0.0}.

isHidden optional

String. If true the topbar is not displayed and the entire view is filled with the camera feed. There is no way of closing the scanner view other than by successfully scanning something. Suitable for kiosk mode.

mask table

Contains masking parameters. All values are in range of 0.0-1.0. Relative to view width or height.

x optional

Float. X coordinate of the masking window. Default is 0.0.

y optional

Float. Y coordinate of the masking window. Default is 0.0.

width optional

Float. Width of the masking window. Default is 1.0.

height optional

Float. Height of the masking window. Default is 1.0.

color optional

Array of floats. RGBA color table for the masking color. Default is {0.0, 0.0, 0.0, 0.5}.

overlay table

Contains filename and a basedir to be used as an overlay image.

filename optional

String. Filename of an overlay image, e.g. 'images/searching_overlay.png'.

baseDir optional

Constant. The base directory for the filename. Default is system.ResourceDirectory.

List of symbols

Android and iOS have different set of supported visual codes.

Android: 'code39', 'code93', 'code128', 'codabar', 'databar', 'databar_exp', 'ean8', 'ean13', 'i25', 'isbn10', 'isbn13', 'partial', 'pdf417', 'qr', 'upca', 'upce'.

iOS: 'aztec', 'code39', 'code39mod43', 'code93', 'code128', 'datamatrix', 'ean8', 'ean13', 'interleaved2of5', 'itf14', 'pdf417', 'qr', 'upce'.