共用方式為


PackageInstaller.InstallExistingPackage Method

Definition

Install the given package, which already exists on the device, for the user for which this installer was created.

[Android.Runtime.Register("installExistingPackage", "(Ljava/lang/String;ILandroid/content/IntentSender;)V", "GetInstallExistingPackage_Ljava_lang_String_ILandroid_content_IntentSender_Handler", ApiSince=29)]
public virtual void InstallExistingPackage (string packageName, Android.Content.PM.InstallReason installReason, Android.Content.IntentSender? statusReceiver);
[<Android.Runtime.Register("installExistingPackage", "(Ljava/lang/String;ILandroid/content/IntentSender;)V", "GetInstallExistingPackage_Ljava_lang_String_ILandroid_content_IntentSender_Handler", ApiSince=29)>]
abstract member InstallExistingPackage : string * Android.Content.PM.InstallReason * Android.Content.IntentSender -> unit
override this.InstallExistingPackage : string * Android.Content.PM.InstallReason * Android.Content.IntentSender -> unit

Parameters

packageName
String

The package to install.

installReason
InstallReason

Reason for install.

statusReceiver
IntentSender

Where to deliver the result of the operation indicated by the extra #EXTRA_STATUS. Refer to the individual status codes on how to handle them.

Attributes

Remarks

Install the given package, which already exists on the device, for the user for which this installer was created.

This will PackageInstaller.SessionParams#setWhitelistedRestrictedPermissions(Set) allowlist all restricted permissions.

Java documentation for android.content.pm.PackageInstaller.installExistingPackage(java.lang.String, int, android.content.IntentSender).

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