This is a plugin to scan barcodes by using Honeywell PDA Android devices.
This plugin uses the native Android SDK available in the Technical Support Downloads Portal for honeywell devices, note that you will need to create an account to download any Honeywell software.
From there you will be able to download the Honeywell_MobilitySDK_Android_vx.xx.zip which contains the Android Data Collection SDK that is the one used in this plugin.
The Honeywell_MobilitySDK_Android is located in Software -> Software and tools -> Developer Library -> SDKs for Android
Inside the .zip file you will find the Android Data Collection SDK that contains the DataCollection.aar
library with sample code, pdf and html documentation enough to understand and work with the Android Data Collection SDK
Note: You do not have to do anything from the description above to be able to use this plugin, it's just a guide for the ones that need to know the source of truth.
Supported devices
CN51
CK75
CN75
CN75e
CN80
CN85
Dolphin 75e
Dolphin CT40/CT40XP
Dolphin CT50
Dolphin CT60
EDA50
EDA50K
EDA70
Thor VM1A
VM3A
RT10A
CK65
CN80G
CT60XP
If your device doesn't show up in the list above, give it a try anyway...
From any version prior to ^4.0.0+14 you must:
- Rename any mention of
ScannerCallBack
toScannerCallback
in your code. setScannerCallBack
function is no longer available inHoneywellScanner
, if you need to set a scanner callback after scanner constructor you can use thescannerCallback
set property.- Change the override of the
onDecode
function to receive aScannedData
object instead of aString
. ScannedData
object contains the scanned code and other info related to the scanned code.
Run this command:
flutter pub add honeywell_scanner
This will add honeywell_scanner
to your pubspec.yaml dependencies like:
honeywell_scanner: ^latest_version
Then run flutter pub get
to download the library sources to your pub-cache.
Copy the honeywell folder which is inside the example code sources at:
.../.pub-cache/hosted/pub.dartlang.org/honeywell_scanner-x.x.x+x/example/android/honeywell
into your android project module which is going to use this plugin. This step is necessary and crucial because the Honeywell Data Collection Android library is a bundle .aar which has to be referenced as a project library.
Add this include ':honeywell'
to your settings.gradle
in your android project module to allow the plugin to locate the honeywell.aar library.
Add tools:replace="android:label"
under application
tag in your AndroidManifest.xml, this is required because the honeywell.aar library defines an android:label="@string/app_name"
which conflicts with your project's label resulting in a Manifest merger failed error.
If error remains, you should check if xmlns:tools="http://schemas.android.com/tools"
is missing in the manifest block.
To use the honeywell_scanner plugin just:
- Instantiate:
HoneywellScanner honeywellScanner = HoneywellScanner();
You can also set the onDecode and onError callbacks in the constructor like:
HoneywellScanner honeywellScanner = HoneywellScanner(scannerCallback: this);
which uses an abstract callback implementation. Or you can use function callbacks like:
HoneywellScanner honeywellScanner = HoneywellScanner(
onScannerDecodeCallback: (scannedData) {
// Do something here
},
onScannerErrorCallback: (error) {
// Do something here
}
);
- Check if device is supported. Take into account this plugin supports a list of Honeywell devices but not all, so this function ensures you compatibility.
isDeviceSupported = await honeywellScanner.isSupported();
- You can set the scanner callback listeners after constructor like:
honeywellScanner.setScannerCallBack(this);
Or
honeywellScanner.onScannerDecodeCallback = (scannedData) {
// Do something here
};
honeywellScanner.onScannerErrorCallback = (error) {
// Do something here
};
- Override the ScannerCallback methods
@override
void onDecoded(ScannedData? scannedData) {
setState(() {
this.scannedData = scannedData;
});
}
@override
void onError(Exception error) {
setState(() {
errorMessage = error.toString();
});
}
- Setting properties. By default honeywell_scanner sets properties to support all code formats from
CodeFormat
enum, it also sets the trigger control property toautoControl
and disables browser launching when scanning urls. However you can set any property you want by using thehoneywellScanner.setProperties(properties)
in case you need some specific behavior from the scanner. Properties are represented as aMap<String, dynamic>
, so for instance if you want the scanner only scans 1D codes and you want the scanned EAN-13 bar codes to include the last digit (the check digit) and want the scanned Codabar bar codes to include the start/stop digits; then you must set it on properties like:
List<CodeFormat> codeFormats = CodeFormatUtils.ALL_1D_FORMATS;
Map<String, dynamic> properties = {
...CodeFormatUtils.getAsPropertiesComplement(codeFormats), //CodeFormatUtils.getAsPropertiesComplement(...) this function converts a list of CodeFormat enums to its corresponding properties representation.
'DEC_CODABAR_START_STOP_TRANSMIT': true, //This is the Codabar start/stop digit specific property
'DEC_EAN13_CHECK_DIGIT_TRANSMIT': true, //This is the EAN13 check digit specific property
};
honeywellScanner.setProperties(properties);
To know and understand the full list of supported properties you may check the Honeywell SDK documentation (to get SDK documentation read the About Honeywell SDK at the beginning of this README). Anyway you can check a quick documentation in the doc folder on this plugin where you can find the BarcodeReader.html explaining all about barcode reader including properties and the BarcodeReaderProperties.java where you can find all the property values you can set.
- Start scanner listener, at this point the app will be listening for any scanned code when you press the physical PDA button or your in-app button to scan codes:
honeywellScanner.startScanner();
- Stop scanner listener, this will release and close the scanner connection:
honeywellScanner.stopScanner();
- Check if scanner is already started:
honeywellScanner.isStarted;
-
You can also do a
scanner.pauseScanner()
orscanner.resumeScanner()
depending on your app life cycle state. -
Start scanning, this function activates the scanner sensor to scan codes. This is the same as pressing the PDA physical button:
honeywellScanner.startScanning();
- Stop scanning, it cancels the scanning:
honeywellScanner.stopScanning();
- Both
startScaning()
andstopScanning()
uses thesoftwareTrigger(bool state)
function wherestate = true
means scanning andstate = false
menas not scanning- It's recommended to check the example code for a better idea of how to work with this plugin.