Azure Mobile Center … and the art of debugging :-)


As a side project, I recently worked on creating a mobile app for Android (and iOS to be completed). To be honest, the development effort was quite straight forward. The development stack focused on Xamarin, because I do not know a thing about creating a native app for Android nor iOS. But, I do know C# … so, for me this was a natural choice 🙂

My knowledge in the area of Xamarin was quite limited and I did not create an app for Android or iOS before. However, the path from idea to prototyping was really smooth. There are a ton of kickstart packages out there and the documentation is amazing. You’ll find tons of articles, knowledge base and other posts that are really helpful.

After setting up the base software architecture and putting the necessary APIs in place (actually, I created a dedicated Rest API project that talks to the existing backend), the implementation that followed was a no-brainer. I then was able to use my daughter’s Android tablet (thanks honey! 🙂 ) to actually test the app in a real environment. Of course, I used emulators on my dev box, but that for me does not substitute for a real-world test. Everything ran beautifully! … BUT! Then comes the phase where you deploy this app to more users for them to test it with their devices and their accounts within the domain. Guess what happens? The app crashed and what even makes it worse … you do not have a clue why! You ask the user and try to get as much information as possible, you add debug information to the code and finally also manage to get their test credentials so that you can test on your end with their account. To take a long story short, it works on your machine/device, but not on theirs … and, you do not know how to reproduce the behavior. 🙁

This is really frustrating if you do not find a way to reproduce the same behavior in your dev environment. Luckily, there is a new product from Microsoft named Azure Mobile Center (https://mobile.azure.com, currently in preview). What this allows you to do is to add a new “app” to this portal and assign its config details to your source code. In essence, it really just requires the following steps:

  1. Add some NuGet packages to your project … search for:
    • Mobile Center
    • Mobile Center Analytics
    • Mobile Center Crashes
  2. Start the SDK by adding some using statements to your code
    • using Microsoft.Azure.Mobile;
    • using Microsoft.Azure.Mobile.Analytics;
    • using Microsoft.Azure.Mobile.Crashes;
  3. Deploy and run your app and explore the data

Within the Azure Mobile Center you then have a choice to look at the Crashes (including full stack trace) and some Analytics data.

The analytics data provides great insights into the usage of your app and distribution across a huge set of information. Here is just a brief list of data points that you are able to analyze:

  • Active users over time
  • Daily sessions per user
  • Session duration
  • Top devices
  • Countries
  • Languages
  • Active devices per version

But, the most important information for me was to look at the Crashes and get some indication of what could be wrong with the source code. Why does it run without any issues on my end, but not in the beta testers environment?

This information helped me to understand the caveats of Android development (in fact, some of the things are really strange and you have to adjust the source code to accommodate) and the bugs within the app source code.

Anyhow, without the help of Azure Mobile Center, I would not be able to identify and solve these issues.

Happy coding and debugging and I hope Azure Mobile Center is helpful for others to fix their mobile app challenges.

 

Leave a comment

Your email address will not be published. Required fields are marked *