QRCodeScannerSDKConstants for Android
The QRCodeScannerSDKConstants class contains the constants. The following table lists the available constants and parameters.
Properties
Example
- public void OnScanClicked(View v)
- {
- ..
- // We want a vibration feedback after scanning
- // Note that the vibration feedback is activated by default
- intent.putExtra(QRCodeScannerSDKConstants.EXTRA_VIBRATE, true);
- // Indicate which sort of image we want to scan
- intent.putExtra(QRCodeScannerSDKConstants.EXTRA_CODE_TYPE, QRCodeScannerSDKConstants.QR_CODE + QRCodeScannerSDKConstants.CRONTO_CODE);
- // Launch Image Scanner activity
- startActivityForResult(intent, 1);
- }
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data)
- {
- switch (resultCode)
- {
- case RESULT_OK:
- ..
- String result = data.getStringExtra (QRCodeScannerSDKConstants.OUTPUT_RESULT);
- int codeType = data.getIntExtra (QRCodeScannerSDKConstants.OUTPUT_CODE_TYPE, 0);
- // Convert the result
- if (codeType == QRCodeScannerSDKConstants.CRONTO_CODE)
- {
- // we have scan a cronto code => convert the hexa string to string
- byte[] tmp = hexaToBytes(result);
- ..
- }
- else if (codeType == QRCodeScannerSDKConstants.QR_CODE)
- {
- // we have scanned a QR code => display directly the result
- resultTextView.setText(result);
- ..
- }
- }
- }
Known Issue
Known issue with Samsung Galaxy A23
Due to a known issue with the camera on Samsung Galaxy A23, Cronto codes are not decoded properly with the default resolution. The solution to this issue is to increase the resolution using the following code snippet:
var imageAnalysisBuilder = ImageAnalysis.Builder().setTargetRotation(rotation)
// Set Resolution property only for Samsung Galaxy A23 model
if(Build.MANUFACTURER.equals("Samsung", true) && Build.MODEL.contains("A23")) {
imageAnalysisBuilder.setTargetResolution(Size(1080, 1920))
}
imageAnalysisBuilder.build().setAnalyzer(cameraExecutor, QrCodeAnalyzer())