Share via


PackageInstaller.SessionParams.SetRequireUserAction(Int32) Method

Definition

Optionally indicate whether user action should be required when the session is committed.

[Android.Runtime.Register("setRequireUserAction", "(I)V", "GetSetRequireUserAction_IHandler", ApiSince=31)]
public virtual void SetRequireUserAction (int requireUserAction);
[<Android.Runtime.Register("setRequireUserAction", "(I)V", "GetSetRequireUserAction_IHandler", ApiSince=31)>]
abstract member SetRequireUserAction : int -> unit
override this.SetRequireUserAction : int -> unit

Parameters

requireUserAction
Int32

whether user action should be required.

Attributes

Remarks

Optionally indicate whether user action should be required when the session is committed.

Defaults to #USER_ACTION_UNSPECIFIED unless otherwise set. When unspecified for installers using the android.Manifest.permission#REQUEST_INSTALL_PACKAGES REQUEST_INSTALL_PACKAGES permission will behave as if set to #USER_ACTION_REQUIRED, and #USER_ACTION_NOT_REQUIRED otherwise. When requireUserAction is set to #USER_ACTION_REQUIRED, installers will receive a #STATUS_PENDING_USER_ACTION callback once the session is committed, indicating that user action is required for the install to proceed.

For installers that have been granted the android.Manifest.permission#REQUEST_INSTALL_PACKAGES REQUEST_INSTALL_PACKAGES permission, user action will not be required when all of the following conditions are met:

<ul> <li>requireUserAction is set to #USER_ACTION_NOT_REQUIRED.</li> <li>The app being installed targets: <ul> <li>android.os.Build.VERSION_CODES#R API 30 or higher on Android T (android.os.Build.VERSION_CODES#TIRAMISU API 33)</li> <li>android.os.Build.VERSION_CODES#S API 31 or higher <b>after</b> Android T (android.os.Build.VERSION_CODES#TIRAMISU API 33)</li> </ul> </li> <li>The installer is: <ul> <li>The InstallSourceInfo#getUpdateOwnerPackageName() update owner of an existing version of the app (in other words, this install session is an app update) if the update ownership enforcement is enabled.</li> <li>The InstallSourceInfo#getInstallingPackageName() installer of record of an existing version of the app (in other words, this install session is an app update) if the update ownership enforcement isn't enabled.</li> <li>Updating itself.</li> </ul> </li> <li>The installer declares the android.Manifest.permission#UPDATE_PACKAGES_WITHOUT_USER_ACTION UPDATE_PACKAGES_WITHOUT_USER_ACTION permission.</li> </ul>

Note: The target API level requirement will advance in future Android versions. Session owners should always be prepared to handle #STATUS_PENDING_USER_ACTION.

Java documentation for android.content.pm.PackageInstaller.SessionParams.setRequireUserAction(int).

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