3
votes

Does anyone know how to retrieve a ios device's serial number using xamarin forms in C#? I am trying to develop a mobile application, so I would need to differentiate the devices.

For xamarin forms android device I am retrieve serial number using below code:

Java.Lang.String serialnum = (Java.Lang.String)(get.Invoke(c, "gsm.sn1"));
1
FYI: Your Android code will not work on Android 10+ as IMEI and serial number are deemed private and you will have to use the Android Advertising ID instead.SushiHangover

1 Answers

4
votes

That information is private to the user and will not be accessible. If you need to identify a user in some way, you can use the IdentifierForVendor property - that's a unique identifier for a device based on a AppStore developer.

var id = UIDevice.CurrentDevice.IdentifierForVendor;