Archives For Android

Over a year ago, I wrote a quick tip on getting device Unique ID for Windows and Windows Phone (8 & 7). Lately, at RedBit, we have been doing quite a bit of iOS, Android and Windows projects using Xamarin and recently put two articles up on our learnings, Cross Platform Animations using Xamarin Forms and GZip Compression with Xamarin Forms. For different reasons, we needed to use a unique ID to identify devices and getting the device ID on each platform is obviously different.

For iOS you can use the UIDevice.CurrentDevice.IdentifierForVendor which can be called from a Xamarin iOS or Xamarin Forms app.

For Android, again it’s a different API but note, that you need API Level 9 or higher for this to work. It is called as follows from Xamarin Android or Xamarin Forms

For Windows you can reference this post I wrote a while back Getting Device ID on Windows & Windows Phone.

At RedBit we have an internal library that we use and here is an excerpt of our RedBit.Mobile.Hardware class

public string DeviceId { get { return GetDeviceIdInternal(); } } ///
/// Gets a device unique identifier depending on the platform ///

/// string representing the unique id private string GetDeviceIdInternal() { var id = default(string); #if __IOS__ id = UIKit.UIDevice.CurrentDevice.IdentifierForVendor.AsString(); #elif WINDOWS_PHONE id = Windows.Phone.System.Analytics.HostInformation.PublisherHostId; #else id = Android.OS.Build.Serial; #endif return id; } }

I’ve put a sample up on GitHub that outputs the device ID for iOS, Android and Windows. Here is the output on iOS.


As always, comments welcome!

In a recent project the RedBit team worked on, we decided to use Xamarin.Form to  build an app for Windows Phone, iOS and Android. Xamarin Forms is still a v1 product but the Xamarin team is rapidly releasing updates to fill in some gaps. As a developer you still have the opportunity to extend Xamarin Forms, for example by building custom renderers. We’ll have a series of blog posts on some learnings from the team to help extend Xamarin.Forms and meet our client’s requirements.

For this first post we’ll be looking at how to implement GZip Compression across iOS, Android and Windows. The benefit to using GZip is there is less data going over the wire reducing mobile data consumption. In the US it’s not much of a problem to send large amounts of data because of unlimited data plans, but in Canada (and other parts of the world) data is not so cheap. In terms of compression, here is a chart showing the difference in data size making a request to

To read more about how to use GZip Compression with Xamarin Forms head over to the RedBit post to see the entire walkthrough.