Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
Builder class for constructing InstallConstraints
.
Summary
Public constructors
Public methods
setAppNotInteractingRequired
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
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# PackageInstaller.InstallConstraints.Builder\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/content/pm/PackageInstaller.InstallConstraints.Builder \"View this page in Java\") \n\n```\nclass Builder\n```\n\n|---|---------------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.content.pm.PackageInstaller.InstallConstraints.Builder](#) |\n\nBuilder class for constructing [InstallConstraints](/reference/kotlin/android/content/pm/PackageInstaller.InstallConstraints).\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------|---|\n| [Builder](#Builder())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|\n| [PackageInstaller.InstallConstraints](/reference/kotlin/android/content/pm/PackageInstaller.InstallConstraints) | [build](#build())`()` Builds a new [InstallConstraints](/reference/kotlin/android/content/pm/PackageInstaller.InstallConstraints) instance. |\n| [PackageInstaller.InstallConstraints.Builder](#) | [setAppNotForegroundRequired](#setAppNotForegroundRequired())`()` This constraint requires the app in question is not in the foreground. |\n| [PackageInstaller.InstallConstraints.Builder](#) | [setAppNotInteractingRequired](#setAppNotInteractingRequired())`()` This constraint requires the app in question is not interacting with the user. |\n| [PackageInstaller.InstallConstraints.Builder](#) | [setAppNotTopVisibleRequired](#setAppNotTopVisibleRequired())`()` This constraint requires the app in question is not top-visible to the user. |\n| [PackageInstaller.InstallConstraints.Builder](#) | [setDeviceIdleRequired](#setDeviceIdleRequired())`()` This constraint requires the device is idle. |\n| [PackageInstaller.InstallConstraints.Builder](#) | [setNotInCallRequired](#setNotInCallRequired())`()` This constraint requires there is no ongoing call in the device. |\n\nPublic constructors\n-------------------\n\n### Builder\n\n```\nBuilder()\n```\n\nPublic methods\n--------------\n\n### build\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun build(): PackageInstaller.InstallConstraints\n```\n\nBuilds a new [InstallConstraints](/reference/kotlin/android/content/pm/PackageInstaller.InstallConstraints) instance.\n\n| Return ||\n|-----------------------------------------------------------------------------------------------------------------|------------------------------|\n| [PackageInstaller.InstallConstraints](/reference/kotlin/android/content/pm/PackageInstaller.InstallConstraints) | This value cannot be `null`. |\n\n### setAppNotForegroundRequired\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setAppNotForegroundRequired(): PackageInstaller.InstallConstraints.Builder\n```\n\nThis constraint requires the app in question is not in the foreground.\n\n| Return ||\n|--------------------------------------------------|------------------------------|\n| [PackageInstaller.InstallConstraints.Builder](#) | This value cannot be `null`. |\n\n### setAppNotInteractingRequired\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setAppNotInteractingRequired(): PackageInstaller.InstallConstraints.Builder\n```\n\nThis constraint requires the app in question is not interacting with the user. User interaction includes:\n\n- playing or recording audio/video\n- sending or receiving network data\n- being visible to the user\n\n\u003cbr /\u003e\n\n| Return ||\n|--------------------------------------------------|------------------------------|\n| [PackageInstaller.InstallConstraints.Builder](#) | This value cannot be `null`. |\n\n### setAppNotTopVisibleRequired\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setAppNotTopVisibleRequired(): PackageInstaller.InstallConstraints.Builder\n```\n\nThis 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()](#setAppNotForegroundRequired()) because a top-visible app is also a foreground app. This is also a subset of [setAppNotInteractingRequired()](#setAppNotInteractingRequired()) because a top-visible app is interacting with the user.\n\n| Return ||\n|--------------------------------------------------|------------------------------|\n| [PackageInstaller.InstallConstraints.Builder](#) | This value cannot be `null`. |\n\n**See Also**\n\n- [android.app.ActivityManager.RunningAppProcessInfo#IMPORTANCE_FOREGROUND](../../app/ActivityManager.RunningAppProcessInfo.html#IMPORTANCE_FOREGROUND:kotlin.Int) \n\n### setDeviceIdleRequired\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setDeviceIdleRequired(): PackageInstaller.InstallConstraints.Builder\n```\n\nThis constraint requires the device is idle.\n\n| Return ||\n|--------------------------------------------------|------------------------------|\n| [PackageInstaller.InstallConstraints.Builder](#) | This value cannot be `null`. |\n\n### setNotInCallRequired\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun setNotInCallRequired(): PackageInstaller.InstallConstraints.Builder\n```\n\nThis constraint requires there is no ongoing call in the device.\n\n| Return ||\n|--------------------------------------------------|------------------------------|\n| [PackageInstaller.InstallConstraints.Builder](#) | This value cannot be `null`. |"]]