PackageManager Class

Definition

Class for retrieving various kinds of information related to the application packages that are currently installed on the device.

[Android.Runtime.Register("android/content/pm/PackageManager", ApiSince=1, DoNotGenerateAcw=true)]
public abstract class PackageManager : Java.Lang.Object
type PackageManager = class
    inherit Object
Inheritance
PackageManager
Derived
Attributes

Remarks

Android platform documentation

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

PackageManager()
PackageManager(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

DontKillApp
ExtraVerificationId

Extra field name for the ID of a package pending verification.

ExtraVerificationResult

Extra field name for the result of a verification, either VerificationAllow, or VerificationReject.

FeatureActivitiesOnSecondaryDisplays
FeatureAppWidgets

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports app widgets.

FeatureAudioLowLatency

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device's audio pipeline is low-latency, more suitable for audio applications sensitive to delays or lag in sound input or output.

FeatureAudioOutput

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device includes at least one form of audio output, such as speakers, audio jack or streaming over bluetooth

FeatureAudioPro
FeatureAutofill
FeatureAutomotive
FeatureBackup

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device can perform backup and restore operations on installed applications.

FeatureBluetooth

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device is capable of communicating with other devices via Bluetooth.

FeatureBluetoothLe

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device is capable of communicating with other devices via Bluetooth Low Energy radio.

FeatureCamera

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device has a camera facing away from the screen.

FeatureCameraAny

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device has at least one camera pointing in some direction, or can support an external camera being connected to it.

FeatureCameraAutofocus

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device's camera supports auto-focus.

FeatureCameraCapabilityManualPostProcessing

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): At least one of the cameras on the device supports the Android.Hardware.Camera2.CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING capability level.

FeatureCameraCapabilityManualSensor

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): At least one of the cameras on the device supports the Android.Hardware.Camera2.CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR capability level.

FeatureCameraCapabilityRaw

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): At least one of the cameras on the device supports the Android.Hardware.Camera2.CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_RAW capability level.

FeatureCameraExternal

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device can support having an external camera connected to it.

FeatureCameraFlash

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device's camera supports flash.

FeatureCameraFront

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device has a front facing camera.

FeatureCameraLevelFull

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): At least one of the cameras on the device supports the InfoSupportedHardwareLevel capability level.

FeatureCompanionDeviceSetup
FeatureConnectionService

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The Connection Service API is enabled on the device.

FeatureConsumerIr

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device is capable of communicating with consumer IR devices.

FeatureDeviceAdmin

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports device policy enforcement via device admins.

FeatureEmbedded
FeatureEthernet
FeatureFaketouch

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device does not have a touch screen, but does support touch emulation for basic events.

FeatureFaketouchMultitouchDistinct

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device does not have a touch screen, but does support touch emulation for basic events that supports distinct tracking of two or more fingers.

FeatureFaketouchMultitouchJazzhand

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device does not have a touch screen, but does support touch emulation for basic events that supports tracking a hand of fingers (5 or more fingers) fully independently.

FeatureFingerprint
FeatureFreeformWindowManagement
FeatureGamepad

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device has all of the inputs necessary to be considered a compatible game controller, or includes a compatible game controller in the box.

FeatureHifiSensors
FeatureHomeScreen

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports a home screen that is replaceable by third party applications.

FeatureInputMethods

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports adding new input methods implemented with the InputMethodService API.

FeatureLeanback

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports leanback UI.

FeatureLeanbackOnly
FeatureLiveTv

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports live TV and can display contents from TV inputs implemented with the TvInputService API.

FeatureLiveWallpaper

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports live wallpapers.

FeatureLocation

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports one or more methods of reporting current location.

FeatureLocationGps

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device has a Global Positioning System receiver and can report precise location.

FeatureLocationNetwork

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device can report location with coarse accuracy using a network-based geolocation system.

FeatureManagedUsers

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports creating secondary users and managed profiles via DevicePolicyManager.

FeatureMicrophone

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device can record audio via a microphone.

FeatureMidi
FeatureNfc

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device can communicate using Near-Field Communications (NFC).

FeatureNfcHostCardEmulation

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports host- based NFC card emulation.

FeatureNfcHostCardEmulationNfcf
FeatureOpenglesExtensionPack

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports the OpenGL ES .

FeaturePc
FeaturePictureInPicture
FeaturePrinting

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports printing.

FeatureRamLow
FeatureRamNormal
FeatureScreenLandscape

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports landscape orientation screens.

FeatureScreenPortrait

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports portrait orientation screens.

FeatureSecurelyRemovesUsers

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports secure removal of users.

FeatureSensorAccelerometer

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device includes an accelerometer.

FeatureSensorAmbientTemperature

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device includes an ambient temperature sensor.

FeatureSensorBarometer

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device includes a barometer (air pressure sensor.

FeatureSensorCompass

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device includes a magnetometer (compass).

FeatureSensorGyroscope

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device includes a gyroscope.

FeatureSensorHeartRate

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device includes a heart rate monitor.

FeatureSensorHeartRateEcg

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The heart rate sensor on this device is an Electrocargiogram.

FeatureSensorLight

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device includes a light sensor.

FeatureSensorProximity

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device includes a proximity sensor.

FeatureSensorRelativeHumidity

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device includes a relative humidity sensor.

FeatureSensorStepCounter

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device includes a hardware step counter.

FeatureSensorStepDetector

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device includes a hardware step detector.

FeatureSip

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The SIP API is enabled on the device.

FeatureSipVoip

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports SIP-based VOIP.

FeatureTelephony

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device has a telephony radio with data communication support.

FeatureTelephonyCdma

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device has a CDMA telephony stack.

FeatureTelephonyGsm

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device has a GSM telephony stack.

FeatureTelevision
Obsolete.

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): This is a device dedicated to showing UI on a television.

FeatureTouchscreen

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device's display has a touch screen.

FeatureTouchscreenMultitouch

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device's touch screen supports multitouch sufficient for basic two-finger gesture detection.

FeatureTouchscreenMultitouchDistinct

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device's touch screen is capable of tracking two or more fingers fully independently.

FeatureTouchscreenMultitouchJazzhand

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device's touch screen is capable of tracking a full hand of fingers fully independently -- that is, 5 or more simultaneous independent pointers.

FeatureUsbAccessory

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports connecting to USB accessories.

FeatureUsbHost

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports connecting to USB devices as the USB host.

FeatureVerifiedBoot

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports verified boot.

FeatureVrHeadtracking
FeatureVrMode
FeatureVrModeHighPerformance
FeatureVulkanHardwareCompute
FeatureVulkanHardwareLevel
FeatureVulkanHardwareVersion
FeatureWatch

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): This is a device dedicated to showing UI on a watch.

FeatureWebview

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device has a full implementation of the android.webkit.

FeatureWifi

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports WiFi (802.11) networking.

FeatureWifiAware
FeatureWifiDirect

Feature for GetSystemAvailableFeatures() and HasSystemFeature(String): The device supports Wi-Fi Direct networking.

FeatureWifiPasspoint
MaximumVerificationTimeout
VerificationAllow
Obsolete.

Used as the verificationCode argument for VerifyPendingInstall(Int32, PackageInstallVerification) to indicate that the calling package verifier allows the installation to proceed.

VerificationReject
Obsolete.

Used as the verificationCode argument for VerifyPendingInstall(Int32, PackageInstallVerification) to indicate the calling package verifier does not vote to allow the installation to proceed.

VersionCodeHighest

Properties

Class

Returns the unique instance of Class that represents this object's class.

(Inherited from Object)
DefaultActivityIcon

Return the generic icon for an activity that is used when no specific icon is defined.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
InstantAppCookieMaxBytes
IsInstantApp
IsSafeMode

Return whether the device has been booted into safe mode.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PackageInstaller

Return interface that offers the ability to install, upgrade, and remove applications on the device.

PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

AddPackageToPreferred(String)
AddPermission(PermissionInfo)

Add a new dynamic permission to the system.

AddPermissionAsync(PermissionInfo)
AddPreferredActivity(IntentFilter, MatchResults, ComponentName[], ComponentName)
CanonicalToCurrentPackageNames(String[])

Map from a packages canonical name to the current name in use on the device.

CanRequestPackageInstalls()
CheckPermission(String, String)

Check whether a particular package has been granted a particular permission.

CheckSignatures(Int32, Int32)

Like CheckSignatures(String, String), but takes UIDs of the two packages to be checked.

CheckSignatures(String, String)

Compare the signatures of two packages to determine if the same signature appears in both of them.

ClearInstantAppCookie()
ClearPackagePreferredActivities(String)
Clone()

Creates and returns a copy of this Object.

(Inherited from Object)
CurrentToCanonicalPackageNames(String[])

Map from the current package names in use on the device to whatever the current canonical name of that package is.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Compares this instance with the specified object and indicates if they are equal.

(Inherited from Object)
ExtendVerificationTimeout(Int32, PackageInstallVerification, Int64)

Allows a package listening to the ActionPackageNeedsVerification to extend the default timeout for a response and declare what action to perform after the timeout occurs.

GetActivityBanner(ComponentName)

Retrieve the banner associated with an activity.

GetActivityBanner(Intent)

Retrieve the banner associated with an Intent.

GetActivityIcon(ComponentName)

Retrieve the icon associated with an activity.

GetActivityIcon(Intent)

Retrieve the icon associated with an Intent.

GetActivityInfo(ComponentName, PackageInfoFlags)

Retrieve all of the information we know about a particular activity class.

GetActivityLogo(ComponentName)

Retrieve the logo associated with an activity.

GetActivityLogo(Intent)

Retrieve the logo associated with an Intent.

GetAllPermissionGroups(PackageInfoFlags)

Retrieve all of the known permission groups in the system.

GetApplicationBanner(ApplicationInfo)

Retrieve the banner associated with an application.

GetApplicationBanner(String)

Retrieve the banner associated with an application.

GetApplicationEnabledSetting(String)

Return the enabled setting for an application.

GetApplicationIcon(ApplicationInfo)

Retrieve the icon associated with an application.

GetApplicationIcon(String)

Retrieve the icon associated with an application.

GetApplicationInfo(String, PackageInfoFlags)

Retrieve all of the information we know about a particular package/application.

GetApplicationLabel(ApplicationInfo)
GetApplicationLabelFormatted(ApplicationInfo)

Return the label to use for this application.

GetApplicationLogo(ApplicationInfo)

Retrieve the logo associated with an application.

GetApplicationLogo(String)

Retrieve the logo associated with an application.

GetChangedPackages(Int32)
GetComponentEnabledSetting(ComponentName)

Return the enabled setting for a package component (activity, receiver, service, provider).

GetDrawable(String, Int32, ApplicationInfo)

Retrieve an image from a package.

GetHashCode()

Returns an integer hash code for this object.

(Inherited from Object)
GetInstalledApplications(PackageInfoFlags)

Return a List of all application packages that are installed on the device.

GetInstalledPackages(PackageInfoFlags)

Return a List of all packages that are installed on the device.

GetInstallerPackageName(String)

Retrieve the package name of the application that installed a package.

GetInstantAppCookie()
GetInstrumentationInfo(ComponentName, PackageInfoFlags)

Retrieve all of the information we know about a particular instrumentation class.

GetLaunchIntentForPackage(String)

Returns a "good" intent to launch a front-door activity in a package.

GetLeanbackLaunchIntentForPackage(String)

Return a "good" intent to launch a front-door Leanback activity in a package, for use for example to implement an "open" button when browsing through packages.

GetNameForUid(Int32)

Retrieve the official name associated with a user id.

GetPackageArchiveInfo(String, PackageInfoFlags)

Retrieve overall information about an application package defined in a package archive file

GetPackageGids(String)

Return an array of all of the secondary group-ids that have been assigned to a package.

GetPackageGids(String, PackageInfoFlags)
GetPackageInfo(String, PackageInfoFlags)

Retrieve overall information about an application package that is installed on the system.

GetPackageInfo(VersionedPackage, PackageInfoFlags)
GetPackagesForUid(Int32)

Retrieve the names of all packages that are associated with a particular user id.

GetPackagesHoldingPermissions(String[], PackageInfoFlags)

Return a List of all installed packages that are currently holding any of the given permissions.

GetPackageUid(String, PackageInfoFlags)
GetPermissionGroupInfo(String, PackageInfoFlags)

Retrieve all of the information we know about a particular group of permissions.

GetPermissionInfo(String, PackageInfoFlags)

Retrieve all of the information we know about a particular permission.

GetPreferredActivities(IList<IntentFilter>, IList<ComponentName>, String)
GetPreferredPackages(PackageInfoFlags)

Retrieve the list of all currently configured preferred packages.

GetProviderInfo(ComponentName, PackageInfoFlags)

Retrieve all of the information we know about a particular content provider class.

GetReceiverInfo(ComponentName, PackageInfoFlags)

Retrieve all of the information we know about a particular receiver class.

GetResourcesForActivity(ComponentName)

Retrieve the resources associated with an activity.

GetResourcesForApplication(ApplicationInfo)

Retrieve the resources for an application.

GetResourcesForApplication(String)

Retrieve the resources associated with an application.

GetServiceInfo(ComponentName, PackageInfoFlags)

Retrieve all of the information we know about a particular service class.

GetSharedLibraries(PackageInstallReason)
GetSystemAvailableFeatures()

Get a list of features that are available on the system.

GetSystemSharedLibraryNames()

Get a list of shared libraries that are available on the system.

GetText(String, Int32, ApplicationInfo)
GetTextFormatted(String, Int32, ApplicationInfo)

Retrieve text from a package.

GetUserBadgedDrawableForDensity(Drawable, UserHandle, Rect, Int32)
GetUserBadgedIcon(Drawable, UserHandle)
GetUserBadgedLabel(String, UserHandle)
GetUserBadgedLabelFormatted(ICharSequence, UserHandle)

If the target user is a managed profile of the calling user or the caller is itself a managed profile, then this returns a copy of the label with badging for accessibility services like talkback.

GetXml(String, Int32, ApplicationInfo)

Retrieve an XML file from a package.

HasSystemFeature(String)

Check whether the given feature name is one of the available features as returned by GetSystemAvailableFeatures().

HasSystemFeature(String, Int32)
InvokeIsInstantApp(String)
IsPermissionRevokedByPolicy(String, String)
JavaFinalize()

Invoked when the garbage collector has detected that this instance is no longer reachable.

(Inherited from Object)
Notify()

Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
NotifyAll()

Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
QueryBroadcastReceivers(Intent, PackageInfoFlags)

Retrieve all receivers that can handle a broadcast of the given intent.

QueryContentProviders(String, Int32, PackageInfoFlags)

Retrieve content provider information.

QueryInstrumentation(String, PackageInfoFlags)

Retrieve information about available instrumentation code.

QueryIntentActivities(Intent, PackageInfoFlags)

Retrieve all activities that can be performed for the given intent.

QueryIntentActivityOptions(ComponentName, Intent[], Intent, PackageInfoFlags)

Retrieve a set of activities that should be presented to the user as similar options.

QueryIntentContentProviders(Intent, PackageInfoFlags)

Retrieve all providers that can match the given intent.

QueryIntentServices(Intent, PackageInfoFlags)

Retrieve all services that can match the given intent.

QueryPermissionsByGroup(String, PackageInfoFlags)

Query for all of the permissions associated with a particular group.

RemovePackageFromPreferred(String)
RemovePermission(String)

Removes a permission that was previously added with AddPermission(PermissionInfo).

ResolveActivity(Intent, PackageInfoFlags)

Determine the best action to perform for a given Intent.

ResolveContentProvider(String, PackageInfoFlags)

Find a single content provider by its base path name.

ResolveService(Intent, PackageInfoFlags)

Determine the best service to handle for a given Intent.

SetApplicationCategoryHint(String, Int32)
SetApplicationEnabledSetting(String, ComponentEnabledState, ComponentEnableOption)

Set the enabled setting for an application This setting will override any enabled state which may have been set by the application in its manifest.

SetComponentEnabledSetting(ComponentName, ComponentEnabledState, ComponentEnableOption)

Set the enabled setting for a package component (activity, receiver, service, provider).

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetInstallerPackageName(String, String)

Change the installer associated with a given package.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string containing a concise, human-readable description of this object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
UpdateInstantAppCookie(Byte[])
VerifyPendingInstall(Int32, PackageInstallVerification)

Allows a package listening to the ActionPackageNeedsVerification to respond to the package manager.

Wait()

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

(Inherited from Object)
Wait(Int64)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)
Wait(Int64, Int32)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)

Explicit Interface Implementations

IJavaObjectEx.IsProxy (Inherited from Object)
IJavaObjectEx.KeyHandle (Inherited from Object)
IJavaObjectEx.NeedsActivation (Inherited from Object)
IJavaObjectEx.ToLocalJniHandle() (Inherited from Object)
IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to