The BarcodeQrData structure contains the barcode and QR code results. The IBarcodeQRCodeService interface contains a method for initializing the SDK license and a method for decoding barcode and QR code from a file. In IBarcodeQRCodeService.cs, define an IBarcodeQRCodeService interface and a BarcodeQrData structure. To invoke native platform functionality from shared code, we use the DependencyService class. Get the source code via svn command in terminal:īarcode reader object needs to be created in native code. Therefore, we pick the view example as our codebase and replace the camera2 API with camera API for Android. Native code takes over the whole content page renderingĪlthough Android camera API is out of date, it is still a good choice due to its simplicity.There are some official samples demonstrating how to use the custom renders to bridge the shared code and platform-specific code.
Fortunately, it is not necessary to reinvent the wheel. Our goal is to create camera preview interface and invoke Dynamsoft Barcode Reader SDK for decoding barcode and QR code, thus it is inevitable to put lots of effort into platform-specific code.
Getting Started with Xamarin.Forms Custom Renderers This article demonstrates how to scan barcode and QR code from image file and live video stream using Xamarin.Forms Custom Renderers and Dynamsoft Barcode Reader SDK. NET developers create cross-platform mobile apps for Android and iOS in C#.