Official Content

The Scanner external object lets you programmatically scan barcodes (2D and QR Codes) using the device's camera.
See also Scanner Control to associate an Edit control (attribute or variable) with the ability to enter barcode information directly into the field from the camera.

Scannerexternalobject-Location_png ScanerEO-WithScanFromImageMethod_GX18U13

Properties

It does not have any.

Methods

ScanBarcode method

Scans a linear barcode or QR code and optionally filters a specific list of barcodes.

Return value VarChar(200)
Parameters [ barcodeTypes:Collection(BarcodeTypes) ]
 

Read more in HowTo: Use ScanBarcode method from Scanner external object in Native Mobile applications.

ScanInLoop method

Scans several barcodes at once, optionally using a specific list of barcodes. No user intervention is required until it stops reading.

Return value ScannedBarcodes
Parameters [ beepOnEachRead:Boolean ] [ , barcodeTypes:Collection(BarcodeType) ] 
 

Read more in HowTo: Use the ScanInLoop method from Scanner external object in Native Mobile applications.

ScanFromImage method

Scans one or more barcodes from an image selected by the user.
This method does not require the use of the device camera and can be executed offline. 

Return value ScannedBarcodes
Parameters Image, [barcodeTypes:Collection(BarcodeType)] 
 

Sample

       &Result = Scanner.ScanFromImage(&image, &barcodetypes)

Notes

  • The method returns an empty collection if the image is empty, invalid, or contains no barcodes.
  • If the image contains multiples barcodes, all detected codes will be returned in the collection. 

Events

It does not have any.

Code example

In the shopping cart scenario, suppose you have a Scan button in the Layout to read a product barcode, add it automatically to the cart, and finally edit the product in the cart to show the product info and indicate the quantity:

Event 'Scan'
  Composite
    &EANBarcodeTypes.Add(BarcodeType.EAN_13)
    &ScanBarcode = ScannerAPI.ScanBarcode(&EANBarcodeTypes)
    &CartItemId = CartItem_InsertButNotConfirmed(&ScanBarcode,&Messages)
    WorkWithDevicesCartItem.CartItem.Detail(&CartItemId, &ScanBarcode)
  EndComposite
EndEvent

Domains

BarcodeType domain

Supported barcode types.

Aztec Aztec code linear barcode.
Code128 Code 128 linear barcode.
Code39 Code 39 linear barcode.
Code39Mod43 Code 39 mod 43 linear barcode.
Code93 Code 93 linear barcode.
DataMatrix Data Matrix 2D barcode.
EAN_13 European Article Number 13-digit code linear barcode.
EAN_8 European Article Number 8-digit code linear barcode.
Interleaved2of5  Interleaved 2 of 5 code linear barcode.
ITF14 ITF-14 code linear barcode.
PDF417 PDF147 code 2D barcode.
QR QR code 2D barcode.
UPC_E UPC-E linear barcode.
 

Structured Data Types

ScannedBarcodes

  • Collection( Barcode:VarChar(200) )
    A set of scanned barcode values.

Scenarios

The device's camera can be used in multiple scenarios to enter information more easily without the user having to type. For instance:

  • Retrieve the store's product information from its linear barcode and add it to the shopping cart.
  • Add contact information by reading personal cards/tags, including QR Codes.
  • Read a sequence of several codes (linear or QR codes) until the user decides to stop reading. This can be useful to emulate a supermarket cashier.
  • Scan barcodes or QR codes from an image selected by the user, without using the camera.

Scope

Generators:  AndroidApple

Availability

This external object is available since GeneXus X Evolution 2 Upgrade 3.

See Also

Last update: June 2025 | © GeneXus. All rights reserved. GeneXus Powered by Globant