ConstraintManager


@RequiresCarApi(value = 2)
class ConstraintManager : Manager


Manages various constraints on the library as enforced by the host.

Depending on the host the app is connected to, there could be different various limits that apply, such as the number of items that could be in a list in different templates. An app can use this manager to query for these limits at runtime and react accordingly.

Summary

Constants

const Int

Represents the limit for contents to be shown in a grid format.

const Int

Represents the limit for generic, uniform list contents.

const Int

Represents the limit for contents to be shown in a pane format.

const Int

Represents the limit for list contents that are associated with points of interest.

const Int

Represents the limit for list contents that are associated with navigation routes.

Public functions

Int
getContentLimit(contentLimitType: Int)

Requests for the limit associated with the contentLimitType.

Boolean

Determines if the hosts supports App Driven Refresh.

Constants

CONTENT_LIMIT_TYPE_GRID

Added in 1.1.0
const val CONTENT_LIMIT_TYPE_GRID = 1: Int

Represents the limit for contents to be shown in a grid format.

The limit of this type should be no smaller than the values defined in content_limit_grid, but the host may support a larger limit.

CONTENT_LIMIT_TYPE_LIST

Added in 1.1.0
const val CONTENT_LIMIT_TYPE_LIST = 0: Int

Represents the limit for generic, uniform list contents.

The limit of this type should be no smaller than the values defined in content_limit_list, but the host may support a larger limit.

CONTENT_LIMIT_TYPE_PANE

Added in 1.1.0
const val CONTENT_LIMIT_TYPE_PANE = 4: Int

Represents the limit for contents to be shown in a pane format.

The limit of this type should be no smaller than the values defined in content_limit_pane, but the host may support a larger limit.

CONTENT_LIMIT_TYPE_PLACE_LIST

Added in 1.1.0
const val CONTENT_LIMIT_TYPE_PLACE_LIST = 2: Int

Represents the limit for list contents that are associated with points of interest.

The limit of this type should be no smaller than the values defined in content_limit_place_list, but the host may support a larger limit.

CONTENT_LIMIT_TYPE_ROUTE_LIST

Added in 1.1.0
const val CONTENT_LIMIT_TYPE_ROUTE_LIST = 3: Int

Represents the limit for list contents that are associated with navigation routes.

The limit of this type should be no smaller than the values defined in content_limit_route_list, but the host may support a larger limit.

Public functions

getContentLimit

Added in 1.1.0
fun getContentLimit(contentLimitType: Int): Int

Requests for the limit associated with the contentLimitType.

Throws
androidx.car.app.HostException

if the remote call fails

isAppDrivenRefreshEnabled

Added in 1.3.0
@RequiresCarApi(value = 6)
fun isAppDrivenRefreshEnabled(): Boolean

Determines if the hosts supports App Driven Refresh. This enables applications to refresh lists content without being counted towards a step. If this function returns false the app should return a template that is of the same type and contains the same main content as the previous template, the new template will not be counted against the quota.