Share via


PackageIdentifier Constructors

Definition

Overloads

PackageIdentifier(IntPtr, JniHandleOwnership)
PackageIdentifier(String, Byte[])

Creates a unique identifier for a package.

PackageIdentifier(IntPtr, JniHandleOwnership)

protected PackageIdentifier (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Android.App.AppSearch.PackageIdentifier : nativeint * Android.Runtime.JniHandleOwnership -> Android.App.AppSearch.PackageIdentifier

Parameters

javaReference
IntPtr

nativeint

Applies to

PackageIdentifier(String, Byte[])

Creates a unique identifier for a package.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;[B)V", "", ApiSince=31)]
public PackageIdentifier (string packageName, byte[] sha256Certificate);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;[B)V", "", ApiSince=31)>]
new Android.App.AppSearch.PackageIdentifier : string * byte[] -> Android.App.AppSearch.PackageIdentifier

Parameters

packageName
String

Name of the package.

sha256Certificate
Byte[]

SHA-256 certificate digest of the package.

Attributes

Remarks

Creates a unique identifier for a package.

SHA-256 certificate digests for a signed application can be retrieved with the apksigner tool that is part of the Android SDK build tools. Use apksigner verify --print-certs path/to/apk.apk to retrieve the SHA-256 certificate digest for the target application. Once retrieved, the SHA-256 certificate digest should be converted to a byte[] by decoding it in base16:

new android.content.pm.Signature(outputDigest).toByteArray();

Java documentation for android.app.appsearch.PackageIdentifier.PackageIdentifier(java.lang.String, byte[]).

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