AppOpsManager.CheckOp Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
CheckOp(String, Int32, String) |
Check whether an application can perform an operation. |
CheckOp(String, Int32, String, String) |
Check whether an application can perform an operation. |
CheckOp(String, Int32, String)
Check whether an application can perform an operation.
[Android.Runtime.Register("checkOp", "(Ljava/lang/String;ILjava/lang/String;)I", "GetCheckOp_Ljava_lang_String_ILjava_lang_String_Handler")]
public virtual Android.App.AppOpsManagerMode CheckOp(string op, int uid, string packageName);
[<Android.Runtime.Register("checkOp", "(Ljava/lang/String;ILjava/lang/String;)I", "GetCheckOp_Ljava_lang_String_ILjava_lang_String_Handler")>]
abstract member CheckOp : string * int * string -> Android.App.AppOpsManagerMode
override this.CheckOp : string * int * string -> Android.App.AppOpsManagerMode
Parameters
- op
- String
The operation to check. One of the OPSTR_* constants.
- uid
- Int32
The uid of the application attempting to perform the operation.
- packageName
- String
The name of the application attempting to perform the operation.
Returns
Returns #MODE_ALLOWED
if the operation is allowed, or
#MODE_IGNORED
if it is not allowed and should be silently ignored (without
causing the app to crash).
- Attributes
Exceptions
If the app has been configured to crash on this op.
Remarks
Check whether an application can perform an operation.
For platform versions before android.os.Build.VERSION_CODES#BAKLAVA
, this is <em>not</em> a security check; you must use #noteOp(String, int, String, String, String)
or #startOp(String, int, String, String, String)
for your actual security checks. This function can just be used for a quick check to see if an operation has been disabled for the application, as an early reject of some work.
For platform versions equal to or after android.os.Build.VERSION_CODES#BAKLAVA
, it does the same security check as #noteOp(String, int, String, String, String)
and #startOp(String, int, String, String, String)
, and should be preferred to use.
This API does not modify the time stamp or other data about the operation.
Java documentation for android.app.AppOpsManager.checkOp(java.lang.String, int, java.lang.String)
.
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.
Applies to
CheckOp(String, Int32, String, String)
Check whether an application can perform an operation.
[Android.Runtime.Register("checkOp", "(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;)I", "GetCheckOp_Ljava_lang_String_ILjava_lang_String_Ljava_lang_String_Handler", ApiSince=36)]
public virtual Android.App.AppOpsManagerMode CheckOp(string op, int uid, string packageName, string? attributionTag);
[<Android.Runtime.Register("checkOp", "(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;)I", "GetCheckOp_Ljava_lang_String_ILjava_lang_String_Ljava_lang_String_Handler", ApiSince=36)>]
abstract member CheckOp : string * int * string * string -> Android.App.AppOpsManagerMode
override this.CheckOp : string * int * string * string -> Android.App.AppOpsManagerMode
Parameters
- op
- String
The operation to check. One of the OPSTR_* constants.
- uid
- Int32
The uid of the application attempting to perform the operation.
- packageName
- String
The name of the application attempting to perform the operation.
- attributionTag
- String
The Context#createAttributionContext attribution tag
of the
calling context or null
for default attribution
Returns
Returns #MODE_ALLOWED
if the operation is allowed, or #MODE_IGNORED
if it is not allowed and should be silently ignored (without causing the app to crash).
- Attributes
Remarks
Check whether an application can perform an operation. It does the same security check as #noteOp(String, int, String, String, String)
and #startOp(String, int, String, String, String)
, but does not modify the time stamp or other data about the operation.
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.