Use Mobile Azure Center for Mobile Analytic Crash Reports and More

2017/3/312 min read
bookmark this
Responsive image

Microsoft Mobile Center

Mobile Center bring multiple service into single web based platform for developer, marketing person, manager. You can build, test, distribute and monitor app's analytics and crash report data, so far it's support Native Android, Native iOS, React Native and Xamarin SDK.

Mobile Center - Microsoft

How to use Mobile Center with Xamarin.Form

Register via

Create your account and once login create apps for Android or iOS, at this point (4/15/2017) they don't have support for window yet, but based on their product Roadmap will do in the future. When create apps you will get app secret, add to your app's OnStart() method, app class should be inherit from Xamarin.Forms.Application. So following are the code you need to add.

Add nuget to Xamarin.Form project
  <package id="Microsoft.Azure.Mobile" version="0.7.0" targetFramework="portable45-net45+win8+wpa81" />
  <package id="Microsoft.Azure.Mobile.Analytics" version="0.7.0" targetFramework="portable45-net45+win8+wpa81" />
  <package id="Microsoft.Azure.Mobile.Crashes" version="0.7.0" targetFramework="portable45-net45+win8+wpa81" />
Add code to Xamarin.Form app's onStart method
      MobileCenter.Start("ios={Your iOS app secret created at mobile center portal.};" +
                   "android={Your android app secret created at mobile center portal.};",
                   typeof(Analytics), typeof(Crashes));

Just adding nuget to Xamarin.Form porject and code, you might see following error on debug window. So you'll have to add nuget to Xamarin.Form's Android and iOS projects too.

[0:] [MobileCenter] ASSERT: Cannot use Mobile Center on this target. If you are on Android or iOS, you must add the NuGet packages in the Android and iOS projects as well. Other targets such as Universal Windows Applications are not yet supported.

In Summary, to use Mobile Center at Xamarin.Form

  1. Create account at
  2. Create an App for Android and an App for iOS
  3. Add Nuget Package, Microsoft.Azure.Mobile, Microsoft.Azure.Mobile.Analytics,, Microsoft.Azure.Mobile.Crashes to Xamarin.Form, Android and iOS projects.
  4. Add Mobile Center start code at App.xaml.cs
  5. Should see analytic data by run app on either emulator or actual device.