This fork contains only ZXingSurfaceView for Xanarin.Android, ZXingScannerView for Xanarin.iOS and modified renderers of these views for Xamarin.Forms + ZXingBarcodeImageView. A lot of unnecessary garbage has been removed and classes have been refactored.
ZXing.Net.Mobile is a C#/.NET library based on the open source Barcode Library: ZXing (Zebra Crossing), using the ZXing.Net Port. It works with Xamarin.iOS, Xamarin.Android and Xamarin.Forms. The goal of ZXing.Net.Mobile is to make scanning barcodes as effortless and painless as possible in your own applications.
For Xamarin Forms there is a bit more setup needed. You will need to initialize the library on each platform in your platform specific app project.
On Android, in your main Activity
's OnCreate (..)
implementation, call:
Xamarin.Essentials.Platform.Init(Application);
ZXing.Net.Mobile.Forms.Android.Platform.Init();
ZXing.Net.Mobile for Xamarin.Forms also handles the new Android permission request model for you via Xamarin.Essentials, but you will need to add the following override implementation to your main Activity
as well:
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
{
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
In your AppDelegate
's FinishedLaunching (..)
implementation, call:
ZXing.Net.Mobile.Forms.iOS.Platform.Init();
- Xamarin.iOS
- Xamarin.Android
- Xamarin.Forms
By default, all barcode formats are monitored while scanning. You can change which formats to check for by passing a ZxingScanningOptions instance into the StartScanning method:
var options = new ZXing.Mobile.MobileBarcodeScanningOptions();
options.PossibleFormats = new List<ZXing.BarcodeFormat>() {
ZXing.BarcodeFormat.Ean8, ZXing.BarcodeFormat.Ean13
};
- Aztec
- Code 128
- Code 39
- Code 93
- EAN13
- EAN8
- PDF417
- QR
- UPC-E
ZXing.Net.Mobile is a combination of a lot of peoples' work that I've put together (including my own). So naturally, I'd like to thank everyone who's helped out in any way. Those of you I know have helped I'm listing here, but anyone else that was involved, please let me know!
- ZXing Project and those responsible for porting it to C#
- John Carruthers - https://github.com/JohnACarruthers/zxing.MonoTouch
- Martin Bowling - https://github.com/martinbowling
- Alex Corrado - https://github.com/chkn/zxing.MonoTouch
- ZXing.Net Project - https://github.com/micjahn/ZXing.Net - HUGE effort here to port ZXing to .NET
Apache ZXing.Net.Mobile Copyright 2012 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/).
ZXing.Net is released under the Apache 2.0 license. ZXing.Net can be found here: https://github.com/micjahn/ZXing.Net A copy of the Apache 2.0 license can be found here: https://github.com/micjahn/ZXing.Net/blob/master/COPYING
ZXing is released under the Apache 2.0 license. ZXing can be found here: http://code.google.com/p/zxing/ A copy of the Apache 2.0 license can be found here: https://github.com/zxing/zxing/blob/master/LICENSE
The System.Drawing classes included are from the mono source code which is property of Novell. Copyright notice is intact in source code files.