Xamarin Essentials

Getting Device Information with Xamarin Essentials

Have you ever had the need to make decisions based on certain information about the device? 👀 Yes? This is for you, if not, you will probably do it in the future, join me in this article and you will see how easy it is thanks Deviceinf, API provided by Xamarin Essentials.! 💚


Let’s start!

What is DeviceInfo?

DeviceInfo is a class that allows us to get some information about the device on which our App is running on.

It’s important that you take the time to analyze the requirements of your App, in this way when starting with the code you will save time because you will know better the topic with which you will be working, in this case, the question to start your little analysis is: What  Device information do we can obtain? 🧐 

Let’s know the Device information that we can get! 

La imagen tiene un atributo ALT vacío; su nombre de archivo es DeviceInformation-1024x300.png

➖ The Name, Manufacturer, VersionString and Model properties returns a string.

Device Type: It’s responsible to identify if the application is running on a physical or virtual device (simulator or emulator).

Platform property: This information allows us to obtain the platform of our device. If you want to verify this value, you can check it using the DevicePlatform structure, which I present below:

La imagen tiene un atributo ALT vacío; su nombre de archivo es PlatformProperty-1024x558.png

Idioms property: This information allows us to obtain the type of device on which the application is running. If you want to verify this value, you can check it using the DeviceIdiom structure, which I present below:

La imagen tiene un atributo ALT vacío; su nombre de archivo es idiom-1024x605.png

And done! 🤓  You can now access the Device Information! I hope it worked for you! 💕


Spanish post: http://es.askxammy.com/obteniendo-informacion-del-dispositivo-con-xamarin-essentials/

References: https://docs.microsoft.com/en-us/xamarin/essentials/device-information?tabs=ios?WT.mc_id=DT-MVP-5003353

Tagged , , ,

3 thoughts on “Getting Device Information with Xamarin Essentials

Leave a Reply

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