Android DPM Mode Example
What is DPM Mode for Android? #
Direct Part Marking (DPM) mode is a feature designed to scan barcodes that are directly marked on an item, usually etched or printed onto a surface, instead of printed on a paper label. This mode is particularly useful in industries where items need to be tracked throughout their lifespan. To enable DPM mode, the DataMatrix decoding is enabled and the DPM mode is set to 1. For best results, the decoding speed is set to slow and the barKoder resolution is set to high.
A Region of Interest (ROI) is also set to optimize the viewfinder for scanning.
How to enable DPM Mode? #
Enable via pre-defined template #
You can enable DPM mode via one of our predefined templates.
private fun setDpmMode() {
bkdView.config = BarkoderConfig(this, "LICENSE_KEY") {
Log.i("Licensing SDK: ", it.message)
}
BarkoderHelper.applyConfigSettingsFromTemplate(this, bkdView.config, BarkoderConfigTemplate.DPM,
object : BarkoderConfigCallback { // This is sync callback
override fun onSuccess() {
bkdView.config.isRegionOfInterestVisible = true
bkdView.config.setRegionOfInterest(35f, 40f, 30f, 15f)
}
override fun onFail(p0: BarkoderException?) {
TODO("Not yet implemented")
}
})
}
Enable manually #
Maybe a more straight-forward approach for your use-case would be to directly just enable the required parameters for best DPM scanning. The setting of Region of Interest (ROI) in the case of DPM scanning is a very important step and try not to "skip" it.
private fun setDpmMode() {
bkdView.config = BarkoderConfig(this, "LICENSE_KEY") {
Log.i("Licensing SDK: ", it.message)
}
bkdView.config.isRegionOfInterestVisible = true
bkdView.config.decoderConfig.Datamatrix.enabled = true
bkdView.config.decoderConfig.Datamatrix.dpmMode = true
bkdView.config.decoderConfig.decodingSpeed = Barkoder.DecodingSpeed.Slow
bkdView.config.barkoderResolution = BarkoderResolution.FHD
bkdView.config.setRegionOfInterest(35f, 40f, 30f, 15f) //this is pretty important for DPM mode
}