Udostępnij za pośrednictwem


DevicePolicyManager.InstallExistingPackage(ComponentName, String) Method

Definition

Install an existing package that has been installed in another user, or has been kept after removal via #setKeepUninstalledPackages.

[Android.Runtime.Register("installExistingPackage", "(Landroid/content/ComponentName;Ljava/lang/String;)Z", "GetInstallExistingPackage_Landroid_content_ComponentName_Ljava_lang_String_Handler", ApiSince=28)]
public virtual bool InstallExistingPackage (Android.Content.ComponentName admin, string? packageName);
[<Android.Runtime.Register("installExistingPackage", "(Landroid/content/ComponentName;Ljava/lang/String;)Z", "GetInstallExistingPackage_Landroid_content_ComponentName_Ljava_lang_String_Handler", ApiSince=28)>]
abstract member InstallExistingPackage : Android.Content.ComponentName * string -> bool
override this.InstallExistingPackage : Android.Content.ComponentName * string -> bool

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with.

packageName
String

The package to be installed in the calling profile.

Returns

true if the app is installed; false otherwise.

Attributes

Remarks

Install an existing package that has been installed in another user, or has been kept after removal via #setKeepUninstalledPackages. This function can be called by a device owner, profile owner or a delegate given the #DELEGATION_INSTALL_EXISTING_PACKAGE scope via #setDelegatedScopes. When called in a secondary user or managed profile, the user/profile must be affiliated with the device. See #isAffiliatedUser.

Java documentation for android.app.admin.DevicePolicyManager.installExistingPackage(android.content.ComponentName, java.lang.String).

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