Dela via


Xamarin.Essentials: App Information

The AppInfo class provides information about your application.

Get started

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.

Using AppInfo

Add a reference to Xamarin.Essentials in your class:

using Xamarin.Essentials;

Obtaining Application Information:

The following information is exposed through the API:

// Application Name
var appName = AppInfo.Name;

// Package Name/Application Identifier (com.microsoft.testapp)
var packageName = AppInfo.PackageName;

// Application Version (1.0.0)
var version = AppInfo.VersionString;

// Application Build Number (1)
var build = AppInfo.BuildString;

Displaying Application Settings

The AppInfo class can also display a page of settings maintained by the operating system for the application:

// Display settings page
AppInfo.ShowSettingsUI();

This settings page allows the user to change application permissions and perform other platform-specific tasks.

Platform Implementation Specifics

App information is taken from the AndroidManifest.xml for the following fields:

  • Buildandroid:versionCode in manifest node
  • Name - android:label in the application node
  • PackageName: package in the manifest node
  • VersionStringandroid:versionName in the application node

API

Find more Xamarin videos on Channel 9 and YouTube.