1
我正在測試我正在掃描條形碼的應用程序。這個應用程序將是跨平臺的,所以我正在使用Visual Studio開發Xamarin。我決定使用Scandit,因爲它似乎是Xamarin的最佳條碼掃描庫。Scandit與設備摩托羅拉XT907 - 相機不聚焦
我遇到的問題是在這個特定的設備上,相機非常模糊,似乎無法自動對焦。正因爲如此,我很難得到正確掃描的東西。
手機內置的相機應用程序效果很好,重點突出。其他條形碼應用程序似乎也能夠集中精細。我在另一個Android設備上嘗試了我的應用程序,並且它工作正常。它似乎是這個特定設備和Scandit的結合。
正在掃描的條形碼類型將全部爲code128。我禁用了所有其他類型,似乎有所幫助,但仍然非常難以掃描。
這裏是我的代碼:
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();
}
}