Integrating MobileFirst Quality Assurance into Xamarin.Android app

It all started when I received an email seeking help on using MQA or to be more precise integrating MQA into Xamarin based android app. Before jumping into addressing the problem, let’s define MQA.

What is MQA?

MQA stands for MobileFirst Quality Assurance and is part of the IBM MobileFirst Platform.

IBM MQA provides line of business professionals and development teams with insightful and streamlined quality feedback and metrics from both pre-production and production, enabling them to prioritize and take action to support a dynamic mobile app strategy.

The Features of MQA are

Features of Mobile Quality Assurance.

Features of Mobile Quality Assurance.

Note: To understand more about MQA, visit IBM Mobile Quality Assurance

So, by now we should be good with the first part of our blog title that is MQA. So, the next question is

What is Xamarin.Android?

Xamarin is a platform to create native iOS, Android, Mac and Windows apps in C#. Xamarin.Android allows us to create native Android applications using the same UI controls we would in Java, except with the flexibility and elegance of a modern language (C#).

As we are good with the definitions, let’s address the problem.

What’s the problem in integrating MQA into Xamarin Android app?

At the time of this blog post, the available MQA SDKs are iOS native SDK, Android native SDK and Javascript  SDK.

So, we have to find a workaround to address this use-case. The initial step is to download the Android MQA SDK and see what’s provided. you can download it from here. Once successfully downloaded and unzipped, we should see a jar file namely MQA-Android-library-<version number>.jar  under lib folder.

MQA Android SDK

MQA Android SDK

As Xamarin is C# based, What can we do with this jar file?

We have Xamarin bindings to our rescue, which helps using in consuming .JARs from C#.

Note: Steps to consume MQA Android JAR in a Xamarin.Android app is mentioned here

Xamarin binding project with MQA Android .JAR file

The files of our interest here are MQA-Android-library-2.7.4.jar (Version number may vary) and Metadata.xml.

  • MQA-Android-library-2.7.4.jar file will have all the MQA related classes and methods required for us to start an Android MQA session.
  • Metadata.xml- Allows changes to be made to the final API, such as changing the namespace of the generated binding.

Based on the errors thrown while building the project, Metadata.xml in my case looks like this

Once all the errors are fixed and your binding project builds successfully, add a new Xamarin Android project (if you haven’t added yet). Now, add MQA binding project reference in our Xamarin android app. Note: Both your binding project and Xamarin.Android project should be of same target framework. You can verify this by right clicking on your project -> Options -> General.

Xamarin Android project with added reference to MQA

Xamarin Android project with added reference to MQA

Now, let’s start MQA android session in our Count.Android app. Before doing this, we should create a MQA service on IBM Bluemix. You can follow the instructions mentioned at Getting started with Mobile Quality Assurance- Bluemix or watch this video.

Starting a Mobile Quality Assurance session with the Android SDK entails three steps. First, build a configuration to define how Mobile Quality Assurance works with your app. Second, start the session itself. Third, add tracking to your activities. Open MainActivity.cs file (Android Project) and paste the code provided below

Now, MQA is integrated into Xamarin.Android app and we are good to go.

What we have implemented above is just a drop in the Ocean of MQA, to know more about MQA and its features – Visit MQA Knowledge Centre

Happy Coding !!!

Polyglot & Pragmatic Programmer • Developer Advocate, IBM Cloud • Intel software Innovator • DZone MVB
(Visited 19 times, 1 visits today)

You may also like...

Show Buttons
Hide Buttons