Xamarin.Essentials: Device Information
The DeviceInfo class provides information about the device the application is running on.
To start using this API, read the getting started guide for Xamarin.Essentials to ensure the library is properly installed and set up in your projects.
Add a reference to Xamarin.Essentials in your class:
The following information is exposed through the API:
// Device Model (SMG-950U, iPhone10,6) var device = DeviceInfo.Model; // Manufacturer (Samsung) var manufacturer = DeviceInfo.Manufacturer; // Device Name (Motz's iPhone) var deviceName = DeviceInfo.Name; // Operating System Version Number (7.0) var version = DeviceInfo.VersionString; // Platform (Android) var platform = DeviceInfo.Platform; // Idiom (Phone) var idiom = DeviceInfo.Idiom; // Device Type (Physical) var deviceType = DeviceInfo.DeviceType;
DeviceInfo.Platform correlates to a constant string that maps to the operating system. The values can be checked with the
- DevicePlatform.iOS – iOS
- DevicePlatform.Android – Android
- DevicePlatform.UWP – UWP
- DevicePlatform.Unknown – Unknown
DeviceInfo.Idiom correlates a constant string that maps to the type of device the application is running on. The values can be checked with the
- DeviceIdiom.Phone – Phone
- DeviceIdiom.Tablet – Tablet
- DeviceIdiom.Desktop – Desktop
- DeviceIdiom.TV – TV
- DeviceIdiom.Watch – Watch
- DeviceIdiom.Unknown – Unknown
DeviceInfo.DeviceType correlates an enumeration to determine if the application is running on a physical or virtual device. A virtual device is a simulator or emulator.
Platform Implementation Specifics
iOS does not expose an API for developers to get the name of the specific iOS device. Instead a hardware identifier is returned such as iPhone10,6 which refers to the iPhone X. A mapping of these identifers are not provided by Apple, but can be found on The iPhone Wiki (a non-official source source).
We'd love to hear your thoughts. Choose the type you'd like to provide:
Our feedback system is built on GitHub Issues. Read more on our blog.