Share via


ContentProvider.CallingPackage Property

Definition

Return the package name of the caller that initiated the request being processed on the current thread.

public string? CallingPackage { [Android.Runtime.Register("getCallingPackage", "()Ljava/lang/String;", "")] get; }
[<get: Android.Runtime.Register("getCallingPackage", "()Ljava/lang/String;", "")>]
member this.CallingPackage : string

Property Value

Attributes

Exceptions

if the calling package doesn't belong to the calling UID.

Remarks

Return the package name of the caller that initiated the request being processed on the current thread. The returned package will have been verified to belong to the calling UID. Returns null if not currently processing a request.

This will always return null when processing #getTypeAnonymous(Uri) requests

For #getType(Uri) requests, this will be only available for cases, where the caller can be identified. See #getTypeAnonymous(Uri)

Java documentation for android.content.ContentProvider.getCallingPackage().

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

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