SDK API - Photo Feature
PLEASE NOTE: USAGE OF THIS FEATURES IS RESTRICTED AND AVAILABLE AS CLOSED BETA THROUGH OUR EARLY ACCESS PROGRAM. PLEASE FILL OUT THE REGISTRATION FORM IN ORDER TO APPLY FOR THE PROGRAM
Take an image with MARK2 to increase your process quality.
Taking Images with MARK
You want to be able to initiate image taking mode and receive images taken with the connected device, to do this call scannerManager.startImageMode(...)
, after you have initialized the scannerManager.
You should provide a configuration for the image mode which is done through the PgImageConfig
class,
timeout (in milliseconds) for the user to take the picture,
callback that handles the response. For this callback implement the IPgImageCallback
interface (code in Kotlin):
takeImageButton.setOnClickListener {
val timeout = 10000
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
}
}
}
scannerManager.startImageMode(config, timeout, imageCallback)
}