PackageInstaller.InstallConstraints.Builder


public static final class PackageInstaller.InstallConstraints.Builder
extends Object

java.lang.Object
   ↳ android.content.pm.PackageInstaller.InstallConstraints.Builder


Builder class for constructing InstallConstraints.

Summary

Public constructors

Builder()

Public methods

PackageInstaller.InstallConstraints build()

Builds a new InstallConstraints instance.

PackageInstaller.InstallConstraints.Builder setAppNotForegroundRequired()

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

PackageInstaller.InstallConstraints.Builder setAppNotInteractingRequired()

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

PackageInstaller.InstallConstraints.Builder setAppNotTopVisibleRequired()

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

PackageInstaller.InstallConstraints.Builder setDeviceIdleRequired()

This constraint requires the device is idle.

PackageInstaller.InstallConstraints.Builder setNotInCallRequired()

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

Inherited methods

Public constructors

Builder

public Builder ()

Public methods

build

Added in API level 34
public PackageInstaller.InstallConstraints build ()

Builds a new InstallConstraints instance.

Returns
PackageInstaller.InstallConstraints This value cannot be null.

setAppNotForegroundRequired

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

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

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

setAppNotInteractingRequired

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

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

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

setAppNotTopVisibleRequired

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

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.

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

setDeviceIdleRequired

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

This constraint requires the device is idle.

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

setNotInCallRequired

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

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

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