Skip to content

Learn Mobile Development

Alamgeer's Blog

Menu
  • Home
  • Privacy Policy
Menu
get device and app informations in maui

How to get Device and App Informations in MAUI

Posted on January 4, 2023January 18, 2023 by Learn Mobile Development

As a mobile apps developer, sometimes we need device and app information like device Model, Manufacturer, OS Version, App Version, Package Name etc. to perform some actions. That’s why in this article i am going to show you how to get device and app Informations in MAUI.

Let’s Start

In this article you will see :

  • What is DeviceInfo?
  • What is AppInfo?

What is DeviceInfo?

  • DeviceInfo is a class in MAUI that allows us to get device information on which our App is running on.

Device information that we can get using DeviceInfo class : 

  • Model – It provides us device model. (eg : iPhone13)
  • Manufacturer – It provides us device Manufacturer. (eg : Apple)
  • Name – It provides us device name. (eg : Alamgeer’s iPhone)
  • VersionString -It provides us os version. (eg : 16.2)
  • Idiom – It provides us types of device on which the application is running on. It can be Phone, Tablet, Desktop, TV, Watch etc.
  • Platform – It provides us device platform. It can be Android, iOS, WinUI, MacCatalyst, Tizen etc.
  • DeviceType – It provides us types of device and identify if we are running the application on an emulator or physical device.

What is AppInfo?

  • AppInfo is a class in MAUI that allows us to get app Information.

App information that we can get using AppInfo class : 

  • Name – It provides us name of the application. (eg : MAUIDeviceAndAppInfoSample)
  • PackageName – It provides us package name or identifier of the application. (eg : com.companyname.mauideviceandappinfosample)
  • VersionString – It provides us the application version. (eg : 1.0)
  • BuildString – It provides us the build number of the version. (eg : 1)
  • RequestedLayoutDirection – It provides the current requested layout direction. (eg : LeftToRight)
  • RequestedTheme – It provides the current requested theme by the system for your application. (eg : Light)

Let’s move to the coding part !!

Setting up the UI

1 – Create a MainPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="MAUIDeviceAndAppInfoSample.MainPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    BackgroundColor="Black">

    <ScrollView>
        <VerticalStackLayout
            Padding="20"
            BackgroundColor="White"
            Spacing="10">

            <Label
                FontAttributes="Bold"
                FontSize="22"
                Text="Device Informtaion" />

            <Label x:Name="LblDeviceInfo" FontSize="18" />

            <Label
                FontAttributes="Bold"
                FontSize="22"
                Text="App Informtaion" />

            <Label x:Name="LblAppInfo" FontSize="18" />

        </VerticalStackLayout>
    </ScrollView>

</ContentPage>

2 – MainPage.xaml.cs

using System.Text;

namespace MAUIDeviceAndAppInfoSample;

public partial class MainPage : ContentPage
{
    public MainPage()
    {
        InitializeComponent();
        LblDeviceInfo.Text = GetDeviceInfo();
        LblAppInfo.Text = GetAppInfo();
    }

    private string GetDeviceInfo()
    {
        return new StringBuilder()
            .AppendLine($"Model : {DeviceInfo.Current.Model}")
            .AppendLine($"Manufacturer : {DeviceInfo.Current.Manufacturer}")
            .AppendLine($"Name : {DeviceInfo.Name}")
            .AppendLine($"OS Version : {DeviceInfo.VersionString}")
            .AppendLine($"Refresh Rate : {DeviceInfo.Current}")
            .AppendLine($"Idiom : {DeviceInfo.Current.Idiom}")
            .AppendLine($"Platform : {DeviceInfo.Current.Platform}")
            .AppendLine($"Device Type : {DeviceInfo.Current.DeviceType}").ToString();
    }

    private string GetAppInfo()
    {
        return new StringBuilder()
           .AppendLine($"Name : {AppInfo.Current.Name}")
           .AppendLine($"Package : {AppInfo.Current.PackageName}")
           .AppendLine($"Version : {AppInfo.Current.VersionString}")
           .AppendLine($"Build : {AppInfo.Current.BuildString}")
           .AppendLine($"LayoutDirection : {AppInfo.RequestedLayoutDirection}")
           .AppendLine($"Theme : {AppInfo.RequestedTheme}").ToString();
    }
}

That’s all for now!

You can check the full source code here.

Happy Coding! 😀 

You may also like

StateContainer In MAUI

How to use StateContainer in MAUI

Expander in MAUI

How to use Expander in MAUI

Post Views: 510
Share article with

Leave a Reply Cancel reply

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

I'm Alamgeer Ashraf and having 11+ years of experience in enterprises mobile application development with Xamarin Native, Xamarin Forms & .Net MAUI.

Archives

  • February 2023 (1)
  • January 2023 (9)
  • December 2022 (5)
  • November 2022 (6)

Latest Posts

  • Prevent Dark Mode in Xamarin forms
    How to Prevent Dark Mode in Xamarin formsFebruary 3, 2023
  • apply color to Images
    How to apply color to Images and Icons in MAUIJanuary 30, 2023
  • iOS Large Page Title
    How to set iOS large page title in MAUIJanuary 26, 2023
  • Change StatusBar Color
    How to change StatusBar color in MAUIJanuary 22, 2023
  • Item reordering to CollectionView
    How to apply item reordering to CollectionView GridItemsLayout in MAUIJanuary 18, 2023

Popular Posts

  • How to apply color to Images and Icons in MAUI
  • How to use CollectionView as a GridItemLayout in Xamarin Forms
  • How to change StatusBar color in MAUI

Latest Comments

  1. knight online makro on Implementation Of Biometric Authentication in Xamarin FormsFebruary 12, 2026

    Your blog is always a highlight of my day

  2. dịch vụ backlink top.com vn on How to use CollectionView as a GridItemLayout in Xamarin FormsNovember 20, 2025

    Great post, you have pointed out some fantastic details , I besides think this s a very superb website.

  3. ryzen sunucu kirala on Implementation Of Biometric Authentication in Xamarin FormsNovember 4, 2025

    Thank you for sharing your personal experience and wisdom with us Your words are so encouraging and uplifting

  4. dofollow backlinks means on How to use FlexLayout in MAUIOctober 29, 2025

    Perfect piece of work you have done, this site is really cool with superb info .

  5. backlinks que es on How to use ObservableObject in MAUI for Data BindingOctober 28, 2025

    I like this internet site because so much useful stuff on here : D.

Our Visitor

0 0 8 9 3 0
Users Today : 3
Users Yesterday : 0
Users Last 7 days : 20
Users Last 30 days : 109
Users This Month : 92
Total views : 15355
How to use FlexLayout in MAUI
Trending
How to use FlexLayout in MAUI

Category

  • .Net MAUI
  • MAUI Community Toolkit
  • MVVM
  • Xamarin Community Toolkit
  • Xamarin Forms

Contact Me

  • LinkedIn
      © 2026 Learn Mobile Development