I'm currently trying to implement this compontent into my android application built with Xamarins mono for andriod.
I'm having this issue that I can't get any result returned back from the scanner.Scan();
method, the scanner starts and nothing happens?!
So I've tried downloading the sample projects from github and when I try scanning barcodes using the sample code provided there it's the same problem. It will not fire. Here is some of the code responsible for starting the scanner and handeling the result:
public async void ScanArticleNumber()
{
//Tell our scanner to use the default overlay
scanner.UseCustomOverlay = false;
//We can customize the top and bottom text of the default overlay
scanner.TopText = "Hold the camera up to the barcode\nAbout 6 inches away";
scanner.BottomText = "Wait for the barcode to automatically scan!";
//Start scanning
var result = await scanner.Scan();
HandleScanResult(result);
}
void HandleScanResult(ZXing.Result result)
{
string msg = "";
if (result != null && !string.IsNullOrEmpty(result.Text))
msg = "Found Barcode: " + result.Text;
else
msg = "Scanning Canceled!";
Activity.RunOnUiThread(() =>
{
Toast.MakeText(Activity.BaseContext, msg, ToastLength.Short).Show();
});
}
The code never reaches the HandleScanResult method even tho I'm shooting loads of barcodes with the camera.
Any ideas why?