Anyline View Configuration

Outdated Information!

This page is no longer maintained and may contain inaccuracies. Please refer to the updated page for the most current information: Android, iOS.

This section explains the Anyline view configuration in detail.

Configuring your Anyline plugin with JSON

The most common way to set up your Anyline scanning solution, regardless of the platform you are running, would be through a configuration string in the JSON format.

ScanViewPlugins and ScanViews are initialized using JSON strings.

JSON configs for scanning use cases are typically defined on .json text files and loaded into application memory during runtime.

Check out the platform-specific documentation on how to accomplish this for your respective platform.

The Structure of a JSON configuration

A typical Anyline configuration in JSON has the following structure:

  • viewPluginConfig: contains a group of related configurations as follows below:

    • pluginConfig: the plugin to use, and options pertaining to it

    • cutoutConfig: how the scan view cutout would look

    • scanFeedbackConfig: how feedback during scanning would appear and behave

  • cameraConfig: camera properties for the platform

  • flashConfig: platform-specific properties for the flash (or torch) module

From this structure, only viewPluginConfig and its child pluginConfig are required nodes. When an optional node is omitted in the config, the SDKs would determine the best possible default values for your platform.

The following JSON configuration (defining a TIN tire scanning use case) shows a typical example:

{
    "viewPluginConfig": {
        "pluginConfig": {
            "id": "tin-dot",
            "tinConfig": {
                "scanMode": "UNIVERSAL"
            },
            "cancelOnResult": true
        },
        "cutoutConfig": {
            "width": 750,
            "alignment": "top_half",
            "ratioFromSize": { "width": 4, "height": 1 },
            "cornerRadius": 1,
            "strokeColor": "0099ff",
            "strokeWidth": 2,
            "feedbackStrokeColor": "8be9fd"
        },
        "scanFeedbackConfig": {
            "style": "contour_rect",
            "strokeWidth": 2,
            "cornerRadius": 4
        }
    },
    "cameraConfig": {
        "pictureResolution": "1080p"
    },
    "flashConfig": {
        "mode": "manual",
        "alignment": "top_left"
    }
}

We will go over each configuration property in detail in the subsequent sections.

Note that there is a special JSON structure used for composite scanning use-cases. For more details, please head over to the corresponding documentation for your specific platform.

viewPluginConfig

The viewPluginConfig is an aggregate structure containing a pluginConfig, a cutoutConfig, and a scanFeedbackConfig (the latter two of which are optional).

pluginConfig

A pluginConfig defines what scanning models are used (e.g. License Plate, ID, Meter, and so on), as well as scanning options related to the plugin used.

Please see the respective platform’s documentation for complete details on plugin configuration with use cases supported by Anyline.

cutoutConfig

A cutoutConfig includes configuration details on how the scan view’s cutout, which indicate the location within the camera frame the scanning process should concentrate on, should appear.

Property Name Note Default Value

alignment

A preset location in the scan view where the cutout will be placed. Values: top, top_half, center, bottom_half, bottom.

center

width

The cutout’s suggested width in pixels, based on device resolution width. Will be used, unless maxWidthPercent is specified and evaluates to a smaller width.

If zero, will be computed based on values from maxWidthPercent, maxHeightPercent, and ratioFromSize.

0

maxWidthPercent

Numeric value representing the maximum width in percent (0-100) of the scan view the cutout will occupy, subject to constraints set by device resolution, width, and ratioFromSize.

Note: will also work if defined as a string, e.g. 100%.

100

maxHeightPercent

Numeric value representing the maximum height in percent (0-100) of the scan view the cutout will occupy, subject to constraints set by device resolution, width, and ratioFromSize.

Note: will also work if defined as a string, e.g. 100%.

100

ratioFromSize

A size value constraining the cutout width-height ratio. e.g. { "width": 3, "height": 2 }.

If the size is zero, evaluates to a full frame cutout (please note that this only works well for barcode use cases).

{"width": 0, "height": 0}

strokeWidth

Stroke width of the cutout

0

strokeColor

Stroke color of the cutout as a hex string (e.g. "00CCFF")

0099FF

feedbackStrokeColor

Color of the cutout when the scanner is reporting feedback as a hex string (e.g. "00CCFF")

0099FF

cornerRadius

Amount of corner rounding applied to the cutout

0

outerColor

Background color as a hex string. Use a hex string format (either "XXXXXX", or "XXXXXXXX" wherein the first two digits are to be considered as the alpha component)

4D000000

offset

Position offset of the cutout, used in conjunction with alignment. Unit: Absolute pixels (Android, iOS).

{ "x": 0, "y": 0 }

image

(Not currently supported) A custom image used for the cutout

null

animation

Animation type for the cutout when initially displayed. Values: none, fade, zoom

none

cropPadding

Amount of padding to be applied to the cutout (NOTE: use positive amounts only). A crop padding truncates the visual area represented by the cutout used in optimizing scan performance for some plugins. Define as a width-height structure. Unit: Absolute pixels (Android, iOS).

{"width": 0, "height": 0}

cropOffset

Used in conjunction with cropPadding. This offset further adjusts the crop position after the padding is applied. Define as an x-y point structure. Unit: Absolute pixels (Android, iOS).

{ "x": 0, "y": 0 }

While generally all plugins (Technical Capabilities) require a cutout region for best performance and results, Barcode also allows usage completely without a cutoutConfig, resulting in Full Frame Scanning.

To make use of Full Frame Scanning for Barcode simply remove the cutoutConfig completely from your View Configuration .json.

Please be aware that this is only supported on Barcode Scanning.

scanFeedbackConfig

A scanFeedbackConfig determines how the scan view behaves when objects of interest are detected during scanning.

Property Name Note Default Value

style

The scan feedback style displayed when an object is detected.

Possible values:

  • none

  • rect

  • contour_rect

  • contour_underline

  • contour_point

  • animated_rect

rect

strokeColor

Stroke color of the visual feedback. Use a hex string in the XXXXXX format

0099FF

fillColor

Fill color of the visual feedback. Use an "XXXXXXXX" hex string with the first two characters representing the alpha component of the fill

00000000

strokeWidth

Stroke width of the visual feedback, in pixels

2

cornerRadius

The corner rounding level of visual feedback shapes drawn

1

redrawTimeout

The amount of time a visual feedback object remains on screen until it is removed

0

animationDuration

How long the animation lasts, in ms

75

animationStyle

The animation style used with the visual feedback drawn on the scan view. Values: none, traverse_single, traverse_multi, kitt, blink, resize, pulse, and pulse_random

Not supported on iOS.

None

blinkAnimationOnResult

A boolean indicating whether a brief "flicker" of the scan view is shown when an object is successfully scanned

false

beepOnResult

A boolean indicating whether a device beep sound is played when an object is successfully scanned

false

vibrateOnResult

A boolean indicating whether the device should vibrate briefly when an object is succesfully scanned

false

cameraConfig

A cameraConfig configures the camera module to be used during scanning.

Property Name Note Default Value

defaultCamera

Whether to use the back camera (BACK), or the front camera (FRONT)

Possible values:

  • BACK - use the back camera of the phone (facing away from user)

  • FRONT - use the front camera (facing the user)

  • EXTERNAL - use an external camera (experimental!)

BACK

captureResolution

The camera resolution to use. Currently (for iOS) only 1080p is supported.

Possible values (Android only):

  • 1080p - capture with a resolution closest to 1080p (e.g. 1080x1920)

  • 720p - capture with a resolution closest to 720p (e.g. 720x1280)

  • 480p - capture with a resolution closest to 480p (e.g. 480x640)

1080p

pictureResolution

The display resolution to use. Currently (for iOS) only 1080p is supported.

Possible values (Android only):

* 1080p - display with a resolution closest to 1080p (e.g. 1080x1920) * 720p - display with a resolution closest to 720p (e.g. 720x1280) * 480p - display with a resolution closest to 480p (e.g. 480x640)

1080p

zoomGesture

A boolean indicating whether pinch-to-zoom is enabled for the scan view

false

focalLength

The zoom factor (magnification) used by the camera

1

maxFocalLength

If zoomGesture is enabled, defines the maximum magnification factor possible

0

flashConfig

A flashConfig configures the flash (or torch) module which can be used to brighten up the sample for more accurate scanning.

Property Name Note Default Value

mode

Control the flash behavior.

Possible values:

  • none - flash toggle hidden, no manual torch control possible

  • manual_off - flash toggle visible, torch light disabled on start

  • manual_on - flash toggle visible, torch light enabled on start

  • auto - automatic mode, torch light is automatically turned on and off based on ambient lighting

manual_off

alignment

Position of the flash toggle within the scan view, if visible.

Possible values:

  • top

  • top_left

  • top_right

  • bottom

  • bottom_left

  • bottom_right

top_left

offset

Position offset of the flash toggle within the scan view, after alignment is evaluated. Value in pixel or density-independent pixel. Negative values move the button left/up; positive values move the button right/down.

{ "x": 0, "y": 0 }

imageOn

String indicating the image name of the flash toggle for "on". If null, will use the default flash toggle image.

  • Omit the file extension in this parameter

  • Android: place the image into res/drawable folder of your app

  • iOS: place the image somewhere in the main bundle

null

imageOff

String indicating the image name of the flash toggle for "off". If null, will use the default flash toggle image.

  • Omit the file extension in this parameter

  • Android: place the image into res/drawable folder of your app

  • iOS: place the image somewhere in the main bundle

null

imageAuto

String indicating the image name of the flash toggle for "auto". If null, will use the default flash toggle image.

  • Omit the file extension in this parameter

  • Android: place the image into res/drawable folder of your app

  • iOS: place the image somewhere in the main bundle

null

Get help

If there is anything you are missing, you require support, or want to provide us with feedback, please reach out to us via https://support.anyline.com, where you either may find helpful information in our Knowledge Base or you can open a Support Ticket for more specific inquiries.

In order to better assist you, please include any code of your Anyline integration and any ScanViewConfig you are using.