Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder#inhmethods)

# PackageInstaller.InstallConstraints.Builder

*** ** * ** ***

` public static final class PackageInstaller.InstallConstraints.Builder `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.content.pm.PackageInstaller.InstallConstraints.Builder |

<br />

*** ** * ** ***

Builder class for constructing `https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints`.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder#Builder()() ` |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints` | ` https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder#build()() ` Builds a new `https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints` instance. |
| ` https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder` | ` https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder#setAppNotForegroundRequired()() ` This constraint requires the app in question is not in the foreground. |
| ` https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder` | ` https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder#setAppNotInteractingRequired()() ` This constraint requires the app in question is not interacting with the user. |
| ` https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder` | ` https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder#setAppNotTopVisibleRequired()() ` This constraint requires the app in question is not top-visible to the user. |
| ` https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder` | ` https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder#setDeviceIdleRequired()() ` This constraint requires the device is idle. |
| ` https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder` | ` https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder#setNotInCallRequired()() ` This constraint requires there is no ongoing call in the device. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(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` ` https://developer.android.com/reference/java/lang/Object#wait(long)(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` ` https://developer.android.com/reference/java/lang/Object#wait()() `

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

## Public constructors

### Builder

```
public Builder ()
```

<br />

<br />

## Public methods

### build

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PackageInstaller.InstallConstraints build ()
```

Builds a new `https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints` instance.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints` | This value cannot be `null`. <br /> |

### setAppNotForegroundRequired

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PackageInstaller.InstallConstraints.Builder setAppNotForegroundRequired ()
```

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

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder` | This value cannot be `null`. <br /> |

### setAppNotInteractingRequired

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder` | This value cannot be `null`. <br /> |

### setAppNotTopVisibleRequired

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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 `https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder#setAppNotForegroundRequired()` because a top-visible app is also a foreground app. This is also a subset of `https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder#setAppNotInteractingRequired()` because a top-visible app is interacting with the user.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/ActivityManager.RunningAppProcessInfo#IMPORTANCE_FOREGROUND`

### setDeviceIdleRequired

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PackageInstaller.InstallConstraints.Builder setDeviceIdleRequired ()
```

This constraint requires the device is idle.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder` | This value cannot be `null`. <br /> |

### setNotInCallRequired

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PackageInstaller.InstallConstraints.Builder setNotInCallRequired ()
```

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

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder` | This value cannot be `null`. <br /> |