Version 5 brings several new features including:
With these new features we have cleaned up the API and refactored several of the methods.
Most notably the old
ScannerOptions class has been broken up into several options classes controlling different aspects of the process:
ScannerOptions: Now only contains options to control the scanning algorithm (eg symbologies);
ActivityOptons: Contains all the view elements and text that is used in the fullscreen scanning activity (which was the only method in the previous versions);
CameraOptions: Contains options for configuring the camera such as whether to use the front or rear camera;
ViewportOptions(NEW): Contains options for configuring the viewport implementation;
These classes are used in the start scanning methods, used to initiate the scanning process.
There are now 2 approaches to use to create your scanning interface.
startScanActivity(): This method is equivalent to the old
startScan()method but with the new options;
startScanInViewport(): Allows you to launch a camera preview contained to a viewport within your application;
If you wish to continue using the previous full screen activity method the
startScan() method has been removed and you should now use
So you may have something like the following code:
This should become:
You can pass
null for any of these options if you just wish to use the defaults. eg the above is the equivalent of:
The events are mainly the same except that the code found results are no longer directly attached to the Event object, but contained within a
So the following code: