PackageIdentifier Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| PackageIdentifier(IntPtr, JniHandleOwnership) |
Creates a managed instance that represents an existing Java object. |
| PackageIdentifier(String, Byte[]) |
Creates a unique identifier for a package. |
PackageIdentifier(IntPtr, JniHandleOwnership)
Creates a managed instance that represents an existing Java object.
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
A JNI reference to the Java object.
- transfer
- JniHandleOwnership
Specifies whether ownership of the JNI reference transfers to this instance.
Remarks
The runtime calls this constructor to create a managed representation of an existing Java object.
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();
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.