Android Guides | Samples

Android.App.AppOpsManager Class

API for interacting with "application operation" tracking.

See Also: AppOpsManager

Syntax

[Android.Runtime.Register("android/app/AppOpsManager", DoNotGenerateAcw=true)]
public class AppOpsManager : Object

Remarks

API for interacting with "application operation" tracking.

This API is not generally intended for third party application developers; most features are only available to system applications. Obtain an instance of it through Context.GetSystemService(String) with Context.AppOpsService.

[Android Documentation]

Requirements

Namespace: Android.App
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0

The members of Android.App.AppOpsManager are listed below.

See Also: Object

Protected Constructors

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

Public Fields

const
ModeAllowedAppOpsManagerMode (0). Result from AppOpsManager.CheckOp(String,Int32,Int32), AppOpsManager.NoteOp(String,Int32,Int32), AppOpsManager.StartOp(String,Int32,Int32): the given caller is allowed to perform the given operation.
const
ModeDefaultAppOpsManagerMode (3). Result from AppOpsManager.CheckOp(String,Int32,Int32), AppOpsManager.NoteOp(String,Int32,Int32), AppOpsManager.StartOp(String,Int32,Int32): the given caller should use its default security check.
const
ModeErroredAppOpsManagerMode (2). Result from AppOpsManager.CheckOpNoThrow(String,Int32,Int32), AppOpsManager.NoteOpNoThrow(String,Int32,Int32), AppOpsManager.StartOpNoThrow(String,Int32,Int32): the given caller is not allowed to perform the given operation, and this attempt should cause it to have a fatal error, typically a SecurityException.
const
ModeIgnoredAppOpsManagerMode (1). Result from AppOpsManager.CheckOp(String,Int32,Int32), AppOpsManager.NoteOp(String,Int32,Int32), AppOpsManager.StartOp(String,Int32,Int32): the given caller is not allowed to perform the given operation, and this attempt should silently fail (it should not cause the app to crash).
const
OpstrCoarseLocationString. Access to coarse location information.
const
OpstrFineLocationString. Access to fine location information.
const
OpstrGetUsageStatsString. Access to UsageStatsManager.
const
OpstrMonitorHighPowerLocationString. Continually monitoring location data with a relatively high power request.
const
OpstrMonitorLocationString. Continually monitoring location data.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

CheckOp(String, Int32, String) : AppOpsManagerMode
Do a quick check for whether an application might be able to perform an operation.
CheckOpNoThrow(String, Int32, String) : AppOpsManagerMode
Like AppOpsManager.CheckOp(String,Int32,Int32) but instead of throwing a SecurityException it returns AppOpsManager.ModeErrored.
CheckPackage(Int32, String)
Do a quick check to validate if a package name belongs to a UID.
FinishOp(String, Int32, String)
Report that an application is no longer performing an operation that had previously been started with AppOpsManager.StartOp(String,Int32,Int32).
NoteOp(String, Int32, String) : AppOpsManagerMode
Make note of an application performing an operation.
NoteOpNoThrow(String, Int32, String) : AppOpsManagerMode
Like AppOpsManager.NoteOp(String,Int32,Int32) but instead of throwing a SecurityException it returns AppOpsManager.ModeErrored.
StartOp(String, Int32, String) : AppOpsManagerMode
Report that an application has started executing a long-running operation.
StartOpNoThrow(String, Int32, String) : AppOpsManagerMode
Like AppOpsManager.StartOp(String,Int32,Int32) but instead of throwing a SecurityException it returns AppOpsManager.ModeErrored.
StartWatchingMode(String, String, AppOpsManager+IOnOpChangedListener)
Monitor for changes to the operating mode for the given op in the given app package.
StopWatchingMode(AppOpsManager+IOnOpChangedListener)
Stop monitoring that was previously started with AppOpsManager.StartWatchingMode(String,String,String).