I'm developing a QR code scanner with Mobile Vision API (play-services-vision 11.0.1). I've run my application on two Android devices (Xperia SO-04E Android 4.2.2). My application works correctly on one device but does not detect QR code on the other. Camera started correctly, but detected no QR code. Does anyone know a solution? Might does a device's configuration cause this?
A part of source code(Activity written in Kotlin) is as below. I've configured the camera permission in AndroidManifest.xml.
// instantiate barcode detector in an Activity onCreate method
val barcodeDetector = BarcodeDetector.Builder(this).build()
cameraSource = CameraSource.Builder(this, barcodeDetector)
.setAutoFocusEnabled(true)
.setRequestedPreviewSize(1600, 1024)
// set callback
barcodeDetector.setProcessor(object: Detector.Processor<Barcode>?) {
override fun release() {}
override fun receiveDetections(detections: Detector.Detections<Barcode>?) {
・・・
// parse a detected QR code
・・・
}
}