Share via


Context.CheckUriPermission Method

Definition

Overloads

CheckUriPermission(Uri, Int32, Int32, ActivityFlags)

Determine whether a particular process and user ID has been granted permission to access a specific URI.

CheckUriPermission(Uri, String, String, Int32, Int32, ActivityFlags)

Check both a Uri and normal permission.

CheckUriPermission(Uri, Int32, Int32, ActivityFlags)

Determine whether a particular process and user ID has been granted permission to access a specific URI.

[Android.Runtime.Register("checkUriPermission", "(Landroid/net/Uri;III)I", "GetCheckUriPermission_Landroid_net_Uri_IIIHandler")]
public abstract Android.Content.PM.Permission CheckUriPermission (Android.Net.Uri? uri, int pid, int uid, Android.Content.ActivityFlags modeFlags);
[<Android.Runtime.Register("checkUriPermission", "(Landroid/net/Uri;III)I", "GetCheckUriPermission_Landroid_net_Uri_IIIHandler")>]
abstract member CheckUriPermission : Android.Net.Uri * int * int * Android.Content.ActivityFlags -> Android.Content.PM.Permission

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 check.

Returns

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 specific URI. 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.checkUriPermission(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.

See also

  • <xref:Android.Content.Context.CheckCallingUriPermission(Android.Net.Uri%2c+Android.Content.ActivityFlags)>

Applies to

CheckUriPermission(Uri, String, String, Int32, Int32, ActivityFlags)

Check both a Uri and normal permission.

[Android.Runtime.Register("checkUriPermission", "(Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;III)I", "GetCheckUriPermission_Landroid_net_Uri_Ljava_lang_String_Ljava_lang_String_IIIHandler")]
public abstract Android.Content.PM.Permission CheckUriPermission (Android.Net.Uri? uri, string? readPermission, string? writePermission, int pid, int uid, Android.Content.ActivityFlags modeFlags);
[<Android.Runtime.Register("checkUriPermission", "(Landroid/net/Uri;Ljava/lang/String;Ljava/lang/String;III)I", "GetCheckUriPermission_Landroid_net_Uri_Ljava_lang_String_Ljava_lang_String_IIIHandler")>]
abstract member CheckUriPermission : Android.Net.Uri * string * string * int * int * Android.Content.ActivityFlags -> Android.Content.PM.Permission

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 check.

Returns

PackageManager#PERMISSION_GRANTED if the caller is allowed to access that uri or holds one of the given permissions, or PackageManager#PERMISSION_DENIED if it is not.

Attributes

Remarks

Check both a Uri and normal permission. This allows you to perform both #checkPermission and #checkUriPermission in one call.

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