# ComplicationRequest

Artifact: [androidx.wear.watchface:watchface-complications-data-source](https://developer.android.com/jetpack/androidx/releases/wear-watchface) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchface/complications/datasource/ComplicationDataSourceService.kt+class:androidx.wear.watchface.complications.datasource.ComplicationRequest) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0)

*** ** * ** ***


```
public final class ComplicationRequest
```

<br />

*** ** * ** ***

Data associated with complication request in `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService#onComplicationRequest(androidx.wear.watchface.complications.datasource.ComplicationRequest,androidx.wear.watchface.complications.datasource.ComplicationDataSourceService.ComplicationRequestListener)`.

## Summary

| ### Public constructors |
|---|
| `[ComplicationRequest](https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationRequest#ComplicationRequest(kotlin.Int,androidx.wear.watchface.complications.data.ComplicationType))( int complicationInstanceId, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType complicationType )` **This method is deprecated.** Use a constructor that specifies responseNeededSoon. |
| `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationRequest#ComplicationRequest(kotlin.Int,androidx.wear.watchface.complications.data.ComplicationType,kotlin.Boolean)( int complicationInstanceId, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType complicationType, boolean immediateResponseRequired )` Constructs a `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationRequest` without setting `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationRequest#isForSafeWatchFace()`. |
| `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 33) https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationRequest#ComplicationRequest(kotlin.Int,androidx.wear.watchface.complications.data.ComplicationType,kotlin.Boolean,kotlin.Int)( int complicationInstanceId, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType complicationType, boolean immediateResponseRequired, int isForSafeWatchFace )` |

| ### Public methods |
|---|---|
| `final int` | `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationRequest#getComplicationInstanceId()()` The system's id for the requested complication which is a unique value for the tuple Watch face ComponentName, complication slot ID. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType` | `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationRequest#getComplicationType()()` The `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType` of complication data requested. |
| `final int` | `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationRequest#isForSafeWatchFace()()` Intended for OEM use, returns whether this request is on behalf of a 'safe' watch face as defined by the `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService#METADATA_KEY_SAFE_WATCH_FACES()` meta data in the data source's manifest. |
| `final boolean` | `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationRequest#isImmediateResponseRequired()()` If `true` then `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService.ComplicationRequestListener#onComplicationData(androidx.wear.watchface.complications.data.ComplicationData)` should be called as soon as possible (ideally less than 100ms instead of the usual 20s deadline). |

## Public constructors

### ComplicationRequest

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0)

```
public [ComplicationRequest](https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationRequest#ComplicationRequest(kotlin.Int,androidx.wear.watchface.complications.data.ComplicationType))(
    int complicationInstanceId,
    @NonNull ComplicationType complicationType
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Use a constructor that specifies responseNeededSoon.

### ComplicationRequest

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0)

```
public ComplicationRequest(
    int complicationInstanceId,
    @NonNull ComplicationType complicationType,
    boolean immediateResponseRequired
)
```

Constructs a `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationRequest` without setting `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationRequest#isForSafeWatchFace()`.

### ComplicationRequest

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

```
@RequiresApi(value = 33)
public ComplicationRequest(
    int complicationInstanceId,
    @NonNull ComplicationType complicationType,
    boolean immediateResponseRequired,
    int isForSafeWatchFace
)
```

| Parameters |
|---|---|
| `int complicationInstanceId` | The system's id for the requested complication which is a unique value for the tuple Watch face ComponentName, complication slot ID. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType complicationType` | The type of complication data requested. |
| `boolean immediateResponseRequired` | If `true` then `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService.ComplicationRequestListener#onComplicationData(androidx.wear.watchface.complications.data.ComplicationData)` should be called as soon as possible (ideally less than 100ms instead of the usual 20s deadline). This will only be `true` within a `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService#onStopImmediateComplicationRequests(kotlin.Int)` pair. |
| `int isForSafeWatchFace` | Whether this request is on behalf of a 'safe' watch face as defined by the `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService#METADATA_KEY_SAFE_WATCH_FACES()` meta data in the data source's manifest. The data source may choose to serve different results for a 'safe' watch face. If the data source does not have the privileged permission `com.google.wear.permission.GET_IS_FOR_SAFE_WATCH_FACE`, then this must be null. Value is either `0` or a combination of the following: - `0` - `1` - `2` <br /> |

## Public methods

### getComplicationInstanceId

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0)

```
public final int getComplicationInstanceId()
```

The system's id for the requested complication which is a unique value for the tuple Watch face ComponentName, complication slot ID.

### getComplicationType

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0)

```
public final @NonNull ComplicationType getComplicationType()
```

The `https://developer.android.com/reference/androidx/wear/watchface/complications/data/ComplicationType` of complication data requested.

### isForSafeWatchFace

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

```
public final int isForSafeWatchFace()
```

Intended for OEM use, returns whether this request is on behalf of a 'safe' watch face as defined by the `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService#METADATA_KEY_SAFE_WATCH_FACES()` meta data in the data source's manifest. The data source may choose to serve different results for a 'safe' watch face.

If the `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService#METADATA_KEY_SAFE_WATCH_FACES()` meta data is not defined then this will be `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/TargetWatchFaceSafety#UNKNOWN()`.

Note if the `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService` does not have the privileged permission `com.google.wear.permission.GET_IS_FOR_SAFE_WATCH_FACE`, then this will be `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/TargetWatchFaceSafety#UNKNOWN()`.

### isImmediateResponseRequired

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.1.0)

```
public final boolean isImmediateResponseRequired()
```

If `true` then `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService.ComplicationRequestListener#onComplicationData(androidx.wear.watchface.complications.data.ComplicationData)` should be called as soon as possible (ideally less than 100ms instead of the usual 20s deadline). This will only be `true` within a `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService#onStopImmediateComplicationRequests(kotlin.Int)` pair which will not be called unless the `https://developer.android.com/reference/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService` has privileged permission `com.google.android.wearable.permission.USE_IMMEDIATE_COMPLICATION_UPDATE`.