
In this article, we will see how to use Zxing Intent Integrator in Xamarin Android Applications. We have seen a lot of articles about how to integrate Zxing Plugin in Android & iOS Applications. But the integration of Zxing Intent Integrator is available for Java Android Apps only. So, I have created a Xamarin Library for Xamarin.Android to Zxing Intent Integrator.
Zxing Intent Integrator
This plugin is a port of the official Zxing Intent Integrator and it is not just a binding project. I have converted the library code from Java to C#. We will see how to use it in the coding part.
Steps
I have split this article into 3 steps as follows.
- Step 1: Creating new Xamarin.Android Projects.
- Step 2: Setting up the plugin for Xamarin.Android Application.
- Step 3: Implementing Zxing Intent Integrator in Xamarin.Android Application.
Step 1 - Creating new Xamarin.Android Projects
Create New Project by Selecting New - Project - Select Android App and Click OK.
Step 2 - Setting up the plugin for Xamarin.Android Application
In this step, we will include the Zxing plugin for Xamarin.Android Project.
- You can download the plugin by clicking here.
- Right click on the reference and click add reference.
- Then click browse and go to the folder to choose the plugin you downloaded.

- I have created a button and added a click event.
- Then added OnActivityResult Override method as shown below.
- protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
- {
- IntentResult result = IntentIntegrator.ParseActivityResult(requestCode, (int)resultCode, data);
- if (result != null)
- {
- if (result.Contents == null)
- {
- Log.Debug("MainActivity", "Cancelled scan");
- Toast.MakeText(this, "Cancelled", ToastLength.Long).Show();
- }
- else
- {
- Log.Debug("MainActivity", "Scanned");
- Toast.MakeText(this, "Scanned: " + result.Contents, ToastLength.Long).Show();
- }
- }
- else
- {
- base.OnActivityResult(requestCode, resultCode, data);
- }
- }





Rushi MehtaPosted Nov 28, 2018, 6:25 AM
Explained Article very nicely