Added in API level 34

Builder

class Builder
kotlin.Any
   ↳ android.content.pm.PackageInstaller.InstallConstraints.Builder

Builder class for constructing InstallConstraints.

Summary

Public constructors

Public methods
PackageInstaller.InstallConstraints

Builds a new InstallConstraints instance.

PackageInstaller.InstallConstraints.Builder

This constraint requires the app in question is not in the foreground.

PackageInstaller.InstallConstraints.Builder

This constraint requires the app in question is not interacting with the user.

PackageInstaller.InstallConstraints.Builder

This constraint requires the app in question is not top-visible to the user.

PackageInstaller.InstallConstraints.Builder

This constraint requires the device is idle.

PackageInstaller.InstallConstraints.Builder

This constraint requires there is no ongoing call in the device.

Public constructors

Builder

Builder()

Public methods

build

Added in API level 34
fun build(): PackageInstaller.InstallConstraints

Builds a new InstallConstraints instance.

Return
PackageInstaller.InstallConstraints This value cannot be null.

setAppNotForegroundRequired

Added in API level 34
fun setAppNotForegroundRequired(): PackageInstaller.InstallConstraints.Builder

This constraint requires the app in question is not in the foreground.

Return
PackageInstaller.InstallConstraints.Builder This value cannot be null.

setAppNotInteractingRequired

Added in API level 34
fun setAppNotInteractingRequired(): PackageInstaller.InstallConstraints.Builder

This constraint requires the app in question is not interacting with the user. User interaction includes:

  • playing or recording audio/video
  • sending or receiving network data
  • being visible to the user

Return
PackageInstaller.InstallConstraints.Builder This value cannot be null.

setAppNotTopVisibleRequired

Added in API level 34
fun setAppNotTopVisibleRequired(): PackageInstaller.InstallConstraints.Builder

This constraint requires the app in question is not top-visible to the user. A top-visible app is showing UI at the top of the screen that the user is interacting with. Note this constraint is a subset of setAppNotForegroundRequired() because a top-visible app is also a foreground app. This is also a subset of setAppNotInteractingRequired() because a top-visible app is interacting with the user.

Return
PackageInstaller.InstallConstraints.Builder This value cannot be null.

setDeviceIdleRequired

Added in API level 34
fun setDeviceIdleRequired(): PackageInstaller.InstallConstraints.Builder

This constraint requires the device is idle.

Return
PackageInstaller.InstallConstraints.Builder This value cannot be null.

setNotInCallRequired

Added in API level 34
fun setNotInCallRequired(): PackageInstaller.InstallConstraints.Builder

This constraint requires there is no ongoing call in the device.

Return
PackageInstaller.InstallConstraints.Builder This value cannot be null.