Language

AppOpsManager.UnsafeCheckOp(String, Int32, String) Method

Definition

This method was deprecated in API level 36.

[Android.Runtime.Register("unsafeCheckOp", "(Ljava/lang/String;ILjava/lang/String;)I", "GetUnsafeCheckOp_Ljava_lang_String_ILjava_lang_String_Handler", ApiSince=29)]
public virtual Android.App.AppOpsManagerMode UnsafeCheckOp(string op, int uid, string packageName);
[<Android.Runtime.Register("unsafeCheckOp", "(Ljava/lang/String;ILjava/lang/String;)I", "GetUnsafeCheckOp_Ljava_lang_String_ILjava_lang_String_Handler", ApiSince=29)>]
abstract member UnsafeCheckOp : string * int * string -> Android.App.AppOpsManagerMode
override this.UnsafeCheckOp : string * int * string -> Android.App.AppOpsManagerMode

Parameters

op
String

String: The operation to check. One of the OPSTR_* constants. This value cannot be null.

uid
Int32

int: The user id of the application attempting to perform the operation.

packageName
String

String: The name of the application attempting to perform the operation. This value cannot be null.

Returns

Attributes

Remarks

This method was deprecated in API level 36. Use checkOp(String,int,String)

Check whether an application might be able to perform an operation. For platform versions before Build.VERSION_CODES.BAKLAVA, this is not 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 Build.VERSION_CODES.BAKLAVA, this is no longer an unsafe check, and it does the same security check as noteOp(String,int,String,String,String) and startOp(String,int,String,String,String). However, it's preferred to use checkOp(String,int,String), since the word "unsafe" in the name of this API is no longer accurate. This API does not modify the time stamp or other data about the operation.

Throws: SecurityException If the app has been configured to crash on this op.

Android reference for android.app.AppOpsManager.unsafeCheckOp.

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