Skip to main content

ProGlove documentation

Photo Feature

The Standalone SDK enables ProGlove scanners to capture images directly from within your Android application. This can be used for tasks such as documenting damaged goods, verifying labels, or supporting visual inspection workflows.

Initiate the process of capturing an image or photo using the connected scanner. Once the command is received, the scanner enters image-taking mode. To capture an image, aim the scanner at the desired object and press the trigger button.

Warning

Important: Never aim the scanner at a person’s face or eyes. The scanner’s laser may cause injury.

Default photo feature implementation

To start the photo feature, call takeImage() from the PgManager.

In the PgCommand, provide an instance of PgImageConfig, which includes the following parameters:

Parameter

Description

jpegQuality

Desired JPEG quality. Accepts values from 5 to 100. Default value: 20.

resolution

Desired image resolution. Options:

  • ImageResolution.RESOLUTION_1280_960

  • ImageResolution.RESOLUTION_640_480

  • ImageResolution.RESOLUTION_320_240

Default value: ImageResolution.RESOLUTION_640_480.

timeoutMs

Timeout in milliseconds for image-taking mode. Default value: 10000 (10 seconds).

PgCommandParams() is optional and can define command behavior such as queue handling.

The IPgImageCallback interface provides two callback methods:

  • onImageReceived(image: PgImage) – called when the image is successfully captured.

  • onError(error: PgError) – called if an error occurs during image capture.

If the command executes successfully, PgImage is returned, containing:

  • width – image width in pixels.

  • height – image height in pixels.

  • bytes – raw image data as a ByteArray.

val quality = 20 // JPEG quality value (1–100)
// Two additional:
val resolution = ImageResolution.RESOLUTION_1280_960
// ImageResolution.RESOLUTION_640_480
// ImageResolution.RESOLUTION_320_240 
val timeout = 3000 // Timeout between trigger press and photo capture
val config = PgImageConfig(quality, resolution, timeout)
val imageCallback = object : IPgImageCallback {
    override fun onImageReceived(image: PgImage) {
        // Handle received image bytes
    }

    override fun onError(error: PgError) {
        // Handle image capture error
    }
  }
}
val commandParams = PgCommandParams()
val command = PgCommand(config, commandParams)
pgManager.takeImage(command, imageCallback)
Best practices

Notice

  • Always set a reasonable timeout to avoid blocking the workflow.

  • Test different quality and resolution combinations to balance performance and image clarity. Use lower resolutions if faster image transfer or smaller file size is required.

  • Provide user feedback (e.g. vibration, sound, UI indication) to confirm that a photo was captured.