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

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

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.