Compartilhar via


Context.EnforcePermission(String, Int32, Int32, String) Method

Definition

If the given permission is not allowed for a particular process and user ID running in the system, throw a SecurityException.

[Android.Runtime.Register("enforcePermission", "(Ljava/lang/String;IILjava/lang/String;)V", "GetEnforcePermission_Ljava_lang_String_IILjava_lang_String_Handler")]
public abstract void EnforcePermission (string permission, int pid, int uid, string? message);
[<Android.Runtime.Register("enforcePermission", "(Ljava/lang/String;IILjava/lang/String;)V", "GetEnforcePermission_Ljava_lang_String_IILjava_lang_String_Handler")>]
abstract member EnforcePermission : string * int * int * string -> unit

Parameters

permission
String

The name of the permission being checked.

pid
Int32

The process ID being checked against. Must be &gt; 0.

uid
Int32

The UID being checked against. A uid of 0 is the root user, which will pass every permission check.

message
String

A message to include in the exception if it is thrown.

Attributes

Remarks

If the given permission is not allowed for a particular process and user ID running in the system, throw a SecurityException.

Java documentation for android.content.Context.enforcePermission(java.lang.String, int, 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

See also

  • <xref:Android.Content.Context.CheckPermission(System.String%2c+System.Int32%2c+System.Int32)>