다음을 통해 공유


Context.EnforceUriPermission Method

Definition

Overloads

EnforceUriPermission(Uri, Int32, Int32, ActivityFlags, String)

If a particular process and user ID has not been granted permission to access a specific URI, throw SecurityException.

EnforceUriPermission(Uri, String, String, Int32, Int32, ActivityFlags, String)

Enforce both a Uri and normal permission.

EnforceUriPermission(Uri, Int32, Int32, ActivityFlags, String)

If a particular process and user ID has not been granted permission to access a specific URI, throw SecurityException.

[Android.Runtime.Register("enforceUriPermission", "(Landroid/net/Uri;IIILjava/lang/String;)V", "GetEnforceUriPermission_Landroid_net_Uri_IIILjava_lang_String_Handler")]
public abstract void EnforceUriPermission (Android.Net.Uri? uri, int pid, int uid, Android.Content.ActivityFlags modeFlags, string? message);
[<Android.Runtime.Register("enforceUriPermission", "(Landroid/net/Uri;IIILjava/lang/String;)V", "GetEnforceUriPermission_Landroid_net_Uri_IIILjava_lang_String_Handler")>]
abstract member EnforceUriPermission : Android.Net.Uri * int * int * Android.Content.ActivityFlags * string -> unit

Parameters

uri
Uri

The uri that is 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.

modeFlags
ActivityFlags

The access modes to enforce.

message
String

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

Attributes

Remarks

If a particular process and user ID has not been granted permission to access a specific URI, throw SecurityException. This only checks for permissions that have been explicitly granted -- if the given process/uid has more general access to the URI's content provider then this check will always fail.

Java documentation for android.content.Context.enforceUriPermission(android.net.Uri, int, 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.

See also

  • <xref:Android.Content.Context.CheckUriPermission(Android.Net.Uri%2c+System.Int32%2c+System.Int32%2c+System.Int32)>

Applies to

EnforceUriPermission(Uri, String, String, Int32, Int32, ActivityFlags, String)

Enforce both a Uri and normal permission.

[Android.Runtime.Register("enforceUriPermission", "(Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;IIILjava/lang/String;)V", "GetEnforceUriPermission_Landroid_net_Uri_Ljava_lang_String_Ljava_lang_String_IIILjava_lang_String_Handler")]
public abstract void EnforceUriPermission (Android.Net.Uri? uri, string? readPermission, string? writePermission, int pid, int uid, Android.Content.ActivityFlags modeFlags, string? message);
[<Android.Runtime.Register("enforceUriPermission", "(Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;IIILjava/lang/String;)V", "GetEnforceUriPermission_Landroid_net_Uri_Ljava_lang_String_Ljava_lang_String_IIILjava_lang_String_Handler")>]
abstract member EnforceUriPermission : Android.Net.Uri * string * string * int * int * Android.Content.ActivityFlags * string -> unit

Parameters

uri
Uri

The Uri whose permission is to be checked, or null to not do this check.

readPermission
String

The permission that provides overall read access, or null to not do this check.

writePermission
String

The permission that provides overall write access, or null to not do this check.

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.

modeFlags
ActivityFlags

The access modes to enforce.

message
String

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

Attributes

Remarks

Enforce both a Uri and normal permission. This allows you to perform both #enforcePermission and #enforceUriPermission in one call.

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

See also

  • <xref:Android.Content.Context.CheckUriPermission(Android.Net.Uri%2c+System.String%2c+System.String%2c+System.String%2c+System.String%2c+System.String)>

Applies to