I have this in my iOS project to get Zxing working with Xamarin.Forms:
[assembly: ExportRenderer(typeof(KleverLogic.FlashValet.Customer.Shared.Pages.ScannerPage),
typeof(KleverLogic.FlashValet.Customer.iOS.Renderers.ScannerPageRenderer))]
namespace KleverLogic.FlashValet.Customer.iOS.Renderers
{
public class ScannerPageRenderer : PageRenderer
{
ZXingScannerView scanner;
public override void ViewDidLoad()
{
base.ViewDidLoad();
this.View.BackgroundColor = UIColor.Black;
this.scanner = new ZXingScannerView(this.View.Frame);
this.View.AddSubview(this.scanner);
}
public override void ViewDidAppear(bool animated)
{
base.ViewDidAppear(animated);
scanner.StartScanning(this.Result);
}
public void Result(Result result)
{
if (result == null || string.IsNullOrEmpty(result.Text))
return;
scanner.StopScanning();
KleverLogic.FlashValet.Customer.Shared.Pages.ScannerPage.Result = result;
this.InvokeOnMainThread(() => this.NavigationController.PopViewControllerAnimated(true));
}
}
}
However, when it comes to Android I'm a bit lost - not sure what event to override, what to add the ZXingScannerFragment to etc - any pointers?
Dino