/xamarin-aar

Primary LanguageC#MIT LicenseMIT

Xamarin Project with Android AAR

Download

Get the latest Dynamsoft SDK package for Android - DynamsoftBarcodeReader.aar.

What's included?

  • library: convert DynamsoftBarcodeReader.aar to a Xamarin.Android Java Bindings Library.
  • app: a Xamarin Android project for reading barcode.

How to Run?

  1. Build the library project to generate DBRAndroid.dll in Visual Studio 2015.
  2. Open the Android project and add the reference.
  3. Build the Android project and run the app on your mobile device or emulator.

Code Snippet

using Com.Dynamsoft.Barcode;

protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button>(Resource.Id.MyButton);

            button.Click += delegate {
                Bitmap image = BitmapFactory.DecodeResource(Resources, Resource.Drawable.qr);
                BarcodeReader barcodeReader = new BarcodeReader("license");
                ReadResult result = barcodeReader.ReadSingle(image, Barcode.QrCode);

                button.Text = string.Format("{0} clicks! barcode result: {1}", count++, result.Barcodes[0].DisplayValue);
            };
        }

Reference

Blog

How to Use Android AAR File in Xamarin Project