Sdílet prostřednictvím


Context.CheckUriPermissions(IList<Uri>, Int32, Int32, Int32) Method

Definition

Determine whether a particular process and user ID has been granted permission to access a list of URIs.

[Android.Runtime.Register("checkUriPermissions", "(Ljava/util/List;III)[I", "GetCheckUriPermissions_Ljava_util_List_IIIHandler", ApiSince=31)]
public virtual int[] CheckUriPermissions (System.Collections.Generic.IList<Android.Net.Uri> uris, int pid, int uid, int modeFlags);
[<Android.Runtime.Register("checkUriPermissions", "(Ljava/util/List;III)[I", "GetCheckUriPermissions_Ljava_util_List_IIIHandler", ApiSince=31)>]
abstract member CheckUriPermissions : System.Collections.Generic.IList<Android.Net.Uri> * int * int * int -> int[]
override this.CheckUriPermissions : System.Collections.Generic.IList<Android.Net.Uri> * int * int * int -> int[]

Parameters

uris
IList<Uri>

The list of URIs 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
Int32

The access modes to check for the list of uris

Returns

Int32[]

Array of permission grants corresponding to each entry in the list of uris. PackageManager#PERMISSION_GRANTED if the given pid/uid is allowed to access that uri, or PackageManager#PERMISSION_DENIED if it is not.

Attributes

Remarks

Determine whether a particular process and user ID has been granted permission to access a list of URIs. 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.

<strong>Note:</strong> On SDK Version android.os.Build.VERSION_CODES#S, calling this method from a secondary-user's context will incorrectly return PackageManager#PERMISSION_DENIED for all {code uris}.

Java documentation for android.content.Context.checkUriPermissions(java.util.List<android.net.Uri>, int, int, int).

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