共用方式為


PackageInstaller.SessionParams.SetRequestUpdateOwnership(Boolean) Method

Definition

Optionally indicate whether the package being installed needs the update ownership enforcement.

[Android.Runtime.Register("setRequestUpdateOwnership", "(Z)V", "GetSetRequestUpdateOwnership_ZHandler", ApiSince=34)]
public virtual void SetRequestUpdateOwnership (bool enable);
[<Android.Runtime.Register("setRequestUpdateOwnership", "(Z)V", "GetSetRequestUpdateOwnership_ZHandler", ApiSince=34)>]
abstract member SetRequestUpdateOwnership : bool -> unit
override this.SetRequestUpdateOwnership : bool -> unit

Parameters

enable
Boolean
Attributes

Remarks

Optionally indicate whether the package being installed needs the update ownership enforcement. Once the update ownership enforcement is enabled, the other installers will need the user action to update the package even if the installers have been granted the android.Manifest.permission#INSTALL_PACKAGES INSTALL_PACKAGES permission. Default to false.

The update ownership enforcement can only be enabled on initial installation. Set this to true on package update is a no-op.

Apps may opt themselves out of update ownership by setting the android:alllowUpdateOwnership attribute in their manifest to false.

Note: To enable the update ownership enforcement, the installer must have the android.Manifest.permission#ENFORCE_UPDATE_OWNERSHIP ENFORCE_UPDATE_OWNERSHIP permission.

Java documentation for android.content.pm.PackageInstaller.SessionParams.setRequestUpdateOwnership(boolean).

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