October 1st, 2013

Industrial Strength Barcode Scanning

Jayme Singleton
Senior Program Manager C&AI

Barcode scanning will likely go down as one of the first killer business apps in the smartphone revolution: QR codes crossed over into mainstream culture, shoppers can scan items in stores for competitive pricing information, and the list goes on. It’s an easy technology to add, and it demos really well. It comes with its own challenges, however: slow scanning times, difficulty in low-light situations, trouble reading barcodes scanned at an off-angle, or reading barcodes printed on irregular surfaces, like a plastic bag. These hiccups can drive users mad with frustration.

Scandit’s bar code scanning library, now available on the Xamarin Store, addresses these issues. They pack a lot of impressive technology into their library. I’ve run my own tests with it using both an iPhone 4S and a ZTE Warp Sequent Android phone. The hardware in both of these phones is a couple of generations old. Even still, Scandit read many barcodes without requiring the phone’s camera to first focus on the symbol. That’s especially good, because my Warp Sequent has a fixed-focus lens. Scandit even identified many barcodes while the barcode was still gently moving. In all of these tests, I didn’t have to resort to turning on the camera’s LED light.

To learn more, join Xamarin’s Zack Gramana and Scandit’s Christian Floerkemeier for a webinar on October 15, 8:00 AM Pacific on using Scandit in your Xamarin apps. Register

Getting the library up-and-running is quick and easy. Just a few simple lines do the job. On iOS, it looks like:

// Setup the barcode scanner
picker = new ScanditSDKRotatingBarcodePicker (appKey);
picker.OverlayController.Delegate = new OverlayControllerDelegate(picker, this);
// Show the scanning UI.
PresentViewController (picker, true, null);
// Start looking for barcodes.
picker.StartScanning ();

On Android, it looks like:

// Setup the barcode scanner
picker = new ScanditSDKAutoAdjustingBarcodePicker (this, appKey, ScanditSDKAutoAdjustingBarcodePicker.CameraFacingBack);
picker.OverlayView.AddListener (this);

// Start the scanning
picker.StartScanning ();

// Show the scan user interface
SetContentView (picker);

Scandit provides additional customization options, such as a search bar, toolbar, touch button, etc. On iOS, you can “warm up” the picker so that it starts up faster by calling SIBarcodePicker.Prepare (appKey, SICameraFacingDirection.Back);. The iOS 7 version has a some additional enhancements made available by changes Apple made to the SDK to further improve performance.

Processing the results of a successful scan are just as easy. On Android, the callback looks like:

public void DidScanBarcode (string barcode, string symbology) {
	Console.WriteLine ("barcode scanned: {0}, '{1}'", symbology, barcode);

	// stop the camera
	picker.StopScanning ();
}

and on iOS it looks like:

public override void DidScanBarcode (SIOverlayController overlayController, NSDictionary barcode) {
	Console.WriteLine ("barcode scanned: {0}, '{1}'", barcode["symbology"], barcode["barcode"]);

	// stop the camera
	picker.StopScanning ();
}

The value of symbology will be a string identifier such as UPC12, QR, or one of the other 9 symbologies that they support.

Perhaps one the more intriguing aspects of Scandit’s offering is the analytics they provide you, which they call Scanalytics, via their control panel. Here you can see if scans were made in a retail store or not, top products scanned, top categories, and even scan volume by country. They also offer a product lookup web API that provides product details for hundreds of thousands of UPC codes. These additional data services round out what is already an impressive offering.

To learn more, join Xamarin’s Zack Gramana and Scandit’s Christian Floerkemeier for a webinar on October 15, 8:00 AM Pacific on using Scandit in your Xamarin apps. Register

Author

Jayme Singleton
Senior Program Manager C&AI

Proud Business Operations Program Manager at Microsoft for the global Xamarin & .NET Developer communities. Apart from managing developer content, Jayme also collaborates with Microsoft PM teams, MVPs, Community Leaders, and Event Coordinators to organize product launches, MVP Summit, Microsoft /Build, .NET Conf, and other corporate events through the year. You can find her living the "City Life" in New York, or traveling around the world, Carmen Sandiego-style.