I'm testing an application that I'm making that will scan bar codes. This application will be cross platform so I am developing with Xamarin using Visual Studio. I decided to use Scandit since it seems like the best bar code scanning library for Xamarin.
The issue that I'm having is on this specific device, the camera is very blurry and can't seem to auto-focus. Because of this I have a very hard time getting anything to scan properly.
The built in camera app on the phone works great and focuses well. Other bar code apps seem to be able to focus fine also. I tried my app on another Android device, and it works fine. It seems to be the combination of this specific device and Scandit.
The type of bar codes being scanned will all be code128. I disabled all other types and that seemed to help quite a bit, but it's still very difficult to scan.
Here is my code:
public class MainActivity : Activity, Scandit.Interfaces.IScanditSDKListener
{
private ScanditSDKBarcodePicker picker;
const string APP_KEY = "it's a secret.";
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += delegate
{
picker = new ScanditSDKBarcodePicker(this, APP_KEY);
picker.OverlayView.AddListener(this);
picker.SetCode39Enabled(false);
picker.SetCode93Enabled(false);
picker.SetEan13AndUpc12Enabled(false);
picker.SetEan8Enabled(false);
picker.SetUpceEnabled(false);
picker.SetItfEnabled(false);
picker.SetMsiPlesseyEnabled(false);
picker.SetGS1DataBarEnabled(false);
picker.SetGS1DataBarExpandedEnabled(false);
picker.SetQrEnabled(false);
picker.SetDataMatrixEnabled(false);
picker.SetPdf417Enabled(false);
picker.SetCodabarEnabled(false);
picker.StartScanning();
SetContentView(picker);
};
}
public void DidScanBarcode(string barcode, string symbology)
{
Toast.MakeText(this, string.Format("barcode scanned: {0}, '{1}'", symbology, barcode), ToastLength.Long).Show();
}
public void DidCancel()
{
Toast.MakeText(this, "Cancel was pressed.", ToastLength.Long).Show();
}
public void DidManualSearch(string text)
{
Toast.MakeText(this, "Search was used. " + text, ToastLength.Long).Show();
}
}
It turns out it was a bug with the Scandit library for Xamarin. I emailed the developers and they informed me it should be fixed in the next version, which they said would be released in mid November. I downloaded their latest Scandit demo app, which had just been updated, and it works fine now.
So this SHOULD be fixed when Scandit 4.3 is made public.