Skip to main content

ProGlove Documentation

Photo Feature - SDK API

The Photo feature enables to take an photo with your scanner to support your daily workflow quality. This feature is only available using the SDK integration.

Take Photo commands, like all commands that trigger an action on a scanner, are queued in Insight Mobile by default.

By providing a special flag in PgCommandParams, this behavior can be changed to replace the queue with the new command.

To learn more, see Command queueing in Insight Mobile.

To integrate the Photo feature via Intent or SDK API, test the API with an existing app, or build out the feature’s functionalities yourself, check out the Sample app’s code in our GitHub repository.

Take photos with scanner

Prerequisite: Early Access License activated. To test the Photo feature, please apply for the Early Access Program.

To initiate the image-taking mode and receive images taken on the connected device, do this call pgManager.takeImage(...) after you have initialized the pgManager.

You should provide a configuration for the image mode, which is done through the PgImageConfig class, wrapped in a PgCommand and a callback that handles the response. For this callback, implement the IPgImageCallback interface (code in Kotlin).

The PgImageConfig contains one parameter called timeoutMs. This value represents the amount of milliseconds your worker will have to take the image. The callback informing you about a possible time-out error may be delayed to account for processing and transmission time.

The convenience function PgImageConfig.toCommand() used here to wrap PgImageConfig optionally takes a PgCommandParams object, which provides additional control over how the command is executed. For now we only support the replaceQueue flag here, which, if set to true, cancels all commands currently in the queue and adds itself as the first element.

To learn more, see Command queueing in Insight Mobile.

Example 68. SDK
takeImageButton.setOnClickListener {
            val config = PgImageConfig()
            val imageCallback = object : IPgImageCallback {
                override fun onImageReceived(image: PgImage) {
                //sample implementation for showing the picture in an imageView
                    val bmp = BitmapFactory.decodeByteArray(image.bytes, 0, image.bytes.size)
                    //make sure you execute any UI related code on the UI Thread
                    runOnUiThread {
                        imageTaken.setImageBitmap(bmp)
                    }
                }

                override fun onImageError(errorReason: PgError) {
                //implement your logic depending on the error reason returned
                // make sure you execute any UI related code on the UI Thread
                    runOnUiThread {
                        // handle error code here
                    }
                }
            }

            pgManager.takeImage(config.toCommand(), imageCallback)
        }


Image quality and resolution

Using the Photo feature in different lighting work environments can affect the image output. You can adjust the image quality and resolution to get the best result in reference to the environment conditions.

Besides image quality and resolution, lighting, patterns, and coloring have a huge impact too. The table below provides an overview of the environmental conditions and the scanner setup as tested using a MARK 2 Mid Range on firmware v2.2.0.

Image type / environment conditions

Resolution

Highest quality that worked (3 times in a row)

Striped image

High - 1280x960

  • Bright environment - 14

  • Dark environment - 20

Striped image

Mid - 640x480

  • Bright environment - 65

  • Dark environment - 67

Striped image

Low - 320x240

  • Bright environment - 97

  • Dark environment - 98

Colorful image

High - 1280x960

  • Bright environment - 30

  • Dark environment - 30

Colorful image

Mid - 640x480

  • Bright environment - 76

  • Dark environment - 72

Colorful image

Low - 320x240

  • Bright environment - 98

  • Dark environment - 98

Image of the dark background

High - 1280x960

37

Image of the dark background

Mid - 640x480

80

Image of the dark background

Low - 320x240

100

Image of the white background

High - 1280x960

73

Image of the white background

Mid - 640x480

92

Image of the white background

Low - 320x240

100