共用方式為


MockContext.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 override 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")>]
override this.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 > 0.

uid
Int32

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

modeFlags
ActivityFlags

The type of access to grant. May be one or both of GrantReadUriPermission or GrantWriteUriPermission.

message
String

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

Attributes

Remarks

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

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 override 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")>]
override this.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 > 0.

uid
Int32

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

modeFlags
ActivityFlags

The type of access to grant. May be one or both of GrantReadUriPermission or GrantWriteUriPermission.

message
String

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

Attributes

Remarks

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