> Documentation index: https://developer.android.com/reference/llms.txt

# SuspendingTimelineComplicationDataSourceService

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

*** ** * ** ***


```
abstract class SuspendingTimelineComplicationDataSourceService : ComplicationDataSourceService
```

<br />

|---|---|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) ||||||
| ↳ | [android.content.Context](https://developer.android.com/reference/android/content/Context.md.txt) |||||
|   | ↳ | [android.content.ContextWrapper](https://developer.android.com/reference/android/content/ContextWrapper.md.txt) ||||
|   |   | ↳ | [android.app.Service](https://developer.android.com/reference/android/app/Service.md.txt) |||
|   |   |   | ↳ | [androidx.wear.watchface.complications.datasource.ComplicationDataSourceService](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService.md.txt) ||
|   |   |   |   | ↳ | [androidx.wear.watchface.complications.datasource.SuspendingTimelineComplicationDataSourceService](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/datasource/SuspendingTimelineComplicationDataSourceService.md.txt) |

*** ** * ** ***

Kotlin coroutine wrapper for `ComplicationDataSourceService` producing `ComplicationDataTimeline`.

## Summary

| ### Public constructors |
|---|
| `SuspendingTimelineComplicationDataSourceService()` |

| ### Public functions |
|---|---|
| `abstract suspend ComplicationDataTimeline?` | `@UiThread onComplicationRequest(request: ComplicationRequest)` Computes the `ComplicationDataTimeline` for the given `request`. |
| `final Unit` | `onComplicationRequest( request: ComplicationRequest, listener: ComplicationDataSourceService.ComplicationRequestListener )` Called when a complication data update is requested for the given complication id. |
| `open Unit` | `onDestroy()` |

### Inherited functions

From [androidx.wear.watchface.complications.datasource.ComplicationDataSourceService](https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/datasource/ComplicationDataSourceService.md.txt) `abstract ComplicationData?` `getPreviewData(type: ComplicationType)`

A request for representative preview data for the complication, for use in the editor UI.
`final IBinder?` `onBind(intent: Intent)` `open Unit` `@MainThread
onComplicationActivated(
complicationInstanceId: Int,
type: ComplicationType
)`

Called when a complication is activated.
`open Unit` `@MainThread
onComplicationDeactivated(complicationInstanceId: Int)`

Called when a complication is deactivated.
`open Unit` `@MainThread
onStartImmediateComplicationRequests(complicationInstanceId: Int)`

If a metadata key with `METADATA_KEY_IMMEDIATE_UPDATE_PERIOD_MILLISECONDS` is present in the manifest, and the provider has privileged permission `com.google.android.wearable.permission.USE_IMMEDIATE_COMPLICATION_UPDATE`, then `onStartImmediateComplicationRequests` will be called when the watch face is visible and non-ambient.
`open Unit` `@MainThread
onStopImmediateComplicationRequests(complicationInstanceId: Int)`

If a metadata key with `METADATA_KEY_IMMEDIATE_UPDATE_PERIOD_MILLISECONDS` is present in the manifest, and the provider has privileged permission `com.google.android.wearable.permission.USE_IMMEDIATE_COMPLICATION_UPDATE`, then `onStartImmediateComplicationRequests` will be called when the watch face ceases to be visible and non-ambient.
From [android.content.Context](https://developer.android.com/reference/android/content/Context.md.txt) `Boolean` `bindIsolatedService(
service: Intent,
flags: Context.BindServiceFlags,
instanceName: String,
executor: Executor,
conn: ServiceConnection
)` `Int` `getColor(id: Int)` `ColorStateList` `getColorStateList(id: Int)` `Drawable?` `getDrawable(id: Int)` `String` `getString(resId: Int)` `String` `getString(resId: Int, vararg formatArgs: Any)` `T` `<T : Any> getSystemService(serviceClass: Class<T>)` `CharSequence` `getText(resId: Int)` `TypedArray` `obtainStyledAttributes(attrs: IntArray)` `TypedArray` `obtainStyledAttributes(resid: Int, attrs: IntArray)` `TypedArray` `obtainStyledAttributes(set: AttributeSet?, attrs: IntArray)` `TypedArray` `obtainStyledAttributes(
set: AttributeSet?,
attrs: IntArray,
defStyleAttr: Int,
defStyleRes: Int
)` `Unit` `revokeSelfPermissionOnKill(permName: String)` `Unit` `sendBroadcastWithMultiplePermissions(
intent: Intent,
receiverPermissions: Array<String>
)` From [android.content.ContextWrapper](https://developer.android.com/reference/android/content/ContextWrapper.html) `Boolean` `bindIsolatedService(
service: Intent,
flags: Int,
instanceName: String,
executor: Executor,
conn: ServiceConnection
)` `Boolean` `bindService(
service: Intent,
conn: ServiceConnection,
flags: Context.BindServiceFlags
)` `Boolean` `bindService(service: Intent, conn: ServiceConnection, flags: Int)` `Boolean` `bindService(
service: Intent,
flags: Context.BindServiceFlags,
executor: Executor,
conn: ServiceConnection
)` `Boolean` `bindService(
service: Intent,
flags: Int,
executor: Executor,
conn: ServiceConnection
)` `Boolean` `bindServiceAsUser(
service: Intent,
conn: ServiceConnection,
flags: Context.BindServiceFlags,
user: UserHandle
)` `Boolean` `bindServiceAsUser(
service: Intent,
conn: ServiceConnection,
flags: Int,
user: UserHandle
)` `Int` `checkCallingOrSelfPermission(permission: String)` `Int` `checkCallingOrSelfUriPermission(uri: Uri, modeFlags: Int)` `IntArray` `checkCallingOrSelfUriPermissions(uris: MutableList<Uri>, modeFlags: Int)` `Int` `checkCallingPermission(permission: String)` `Int` `checkCallingUriPermission(uri: Uri, modeFlags: Int)` `IntArray` `checkCallingUriPermissions(uris: MutableList<Uri>, modeFlags: Int)` `Int` `checkContentUriPermissionFull(uri: Uri, pid: Int, uid: Int, modeFlags: Int)` `Int` `checkPermission(permission: String, pid: Int, uid: Int)` `Int` `checkSelfPermission(permission: String)` `Int` `checkUriPermission(uri: Uri, pid: Int, uid: Int, modeFlags: Int)` `Int` `checkUriPermission(
uri: Uri?,
readPermission: String?,
writePermission: String?,
pid: Int,
uid: Int,
modeFlags: Int
)` `IntArray` `checkUriPermissions(
uris: MutableList<Uri>,
pid: Int,
uid: Int,
modeFlags: Int
)` `Unit` `clearWallpaper()` `Context` `createAttributionContext(attributionTag: String?)` `Context` `createConfigurationContext(overrideConfiguration: Configuration)` `Context` `createContext(contextParams: ContextParams)` `Context` `createContextForSplit(splitName: String)` `Context` `createDeviceContext(deviceId: Int)` `Context` `createDeviceProtectedStorageContext()` `Context` `createDisplayContext(display: Display)` `Context` `createPackageContext(packageName: String, flags: Int)` `Context` `createWindowContext(type: Int, options: Bundle?)` `Context` `createWindowContext(display: Display, type: Int, options: Bundle?)` `Array<String>` `databaseList()` `Boolean` `deleteDatabase(name: String)` `Boolean` `deleteFile(name: String)` `Boolean` `deleteSharedPreferences(name: String)` `Unit` `enforceCallingOrSelfPermission(permission: String, message: String?)` `Unit` `enforceCallingOrSelfUriPermission(
uri: Uri,
modeFlags: Int,
message: String
)` `Unit` `enforceCallingPermission(permission: String, message: String?)` `Unit` `enforceCallingUriPermission(uri: Uri, modeFlags: Int, message: String)` `Unit` `enforcePermission(permission: String, pid: Int, uid: Int, message: String?)` `Unit` `enforceUriPermission(
uri: Uri,
pid: Int,
uid: Int,
modeFlags: Int,
message: String
)` `Unit` `enforceUriPermission(
uri: Uri?,
readPermission: String?,
writePermission: String?,
pid: Int,
uid: Int,
modeFlags: Int,
message: String?
)` `Array<String>` `fileList()` `File` `getDatabasePath(name: String)` `File` `getDir(name: String, mode: Int)` `File?` `getExternalFilesDir(type: String?)` `Array<File>` `getExternalFilesDirs(type: String)` `File` `getFileStreamPath(name: String)` `SharedPreferences` `getSharedPreferences(name: String, mode: Int)` `Any` `getSystemService(name: String)` `String?` `getSystemServiceName(serviceClass: Class<*>)` `Unit` `grantUriPermission(toPackage: String, uri: Uri, modeFlags: Int)` `Boolean` `moveDatabaseFrom(sourceContext: Context, name: String)` `Boolean` `moveSharedPreferencesFrom(sourceContext: Context, name: String)` `FileInputStream` `openFileInput(name: String)` `FileOutputStream` `openFileOutput(name: String, mode: Int)` `SQLiteDatabase` `openOrCreateDatabase(
name: String,
mode: Int,
factory: SQLiteDatabase.CursorFactory
)` `SQLiteDatabase` `openOrCreateDatabase(
name: String,
mode: Int,
factory: SQLiteDatabase.CursorFactory,
errorHandler: DatabaseErrorHandler?
)` `Drawable` `peekWallpaper()` `Unit` `rebindService(conn: ServiceConnection, flags: Context.BindServiceFlags)` `Unit` `registerComponentCallbacks(callback: ComponentCallbacks)` `Unit` `registerDeviceIdChangeListener(executor: Executor, listener: IntConsumer)` `Intent?` `registerReceiver(receiver: BroadcastReceiver?, filter: IntentFilter)` `Intent?` `registerReceiver(
receiver: BroadcastReceiver?,
filter: IntentFilter,
flags: Int
)` `Intent?` `registerReceiver(
receiver: BroadcastReceiver?,
filter: IntentFilter,
broadcastPermission: String?,
scheduler: Handler?
)` `Intent?` `registerReceiver(
receiver: BroadcastReceiver?,
filter: IntentFilter,
broadcastPermission: String?,
scheduler: Handler?,
flags: Int
)` `Unit` `removeStickyBroadcast(intent: Intent)` `Unit` `removeStickyBroadcastAsUser(intent: Intent, user: UserHandle)` `Unit` `revokeSelfPermissionsOnKill(permissions: MutableCollection<String>)` `Unit` `revokeUriPermission(uri: Uri, modeFlags: Int)` `Unit` `revokeUriPermission(targetPackage: String, uri: Uri, modeFlags: Int)` `Unit` `sendBroadcast(intent: Intent)` `Unit` `sendBroadcast(intent: Intent, receiverPermission: String?)` `Unit` `sendBroadcast(intent: Intent, receiverPermission: String?, options: Bundle?)` `Unit` `sendBroadcastAsUser(intent: Intent, user: UserHandle)` `Unit` `sendBroadcastAsUser(
intent: Intent,
user: UserHandle,
receiverPermission: String?
)` `Unit` `sendOrderedBroadcast(intent: Intent, receiverPermission: String?)` `Unit` `sendOrderedBroadcast(
intent: Intent,
receiverPermission: String?,
options: Bundle?
)` `Unit` `sendOrderedBroadcast(
intent: Intent,
receiverPermission: String?,
resultReceiver: BroadcastReceiver?,
scheduler: Handler?,
initialCode: Int,
initialData: String?,
initialExtras: Bundle?
)` `Unit` `sendOrderedBroadcast(
intent: Intent,
receiverPermission: String?,
options: Bundle?,
resultReceiver: BroadcastReceiver?,
scheduler: Handler?,
initialCode: Int,
initialData: String?,
initialExtras: Bundle?
)` `Unit` `sendOrderedBroadcast(
intent: Intent,
receiverPermission: String?,
receiverAppOp: String?,
resultReceiver: BroadcastReceiver?,
scheduler: Handler?,
initialCode: Int,
initialData: String?,
initialExtras: Bundle?
)` `Unit` `sendOrderedBroadcast(
intent: Intent,
initialCode: Int,
receiverPermission: String?,
receiverAppOp: String?,
resultReceiver: BroadcastReceiver?,
scheduler: Handler?,
initialData: String?,
initialExtras: Bundle?,
options: Bundle?
)` `Unit` `sendOrderedBroadcastAsUser(
intent: Intent,
user: UserHandle,
receiverPermission: String?,
resultReceiver: BroadcastReceiver?,
scheduler: Handler?,
initialCode: Int,
initialData: String?,
initialExtras: Bundle?
)` `Unit` `sendStickyBroadcast(intent: Intent)` `Unit` `sendStickyBroadcast(intent: Intent, options: Bundle?)` `Unit` `sendStickyBroadcastAsUser(intent: Intent, user: UserHandle)` `Unit` `sendStickyOrderedBroadcast(
intent: Intent,
resultReceiver: BroadcastReceiver?,
scheduler: Handler?,
initialCode: Int,
initialData: String?,
initialExtras: Bundle?
)` `Unit` `sendStickyOrderedBroadcastAsUser(
intent: Intent,
user: UserHandle,
resultReceiver: BroadcastReceiver?,
scheduler: Handler?,
initialCode: Int,
initialData: String?,
initialExtras: Bundle?
)` `Unit` `setTheme(resid: Int)` `Unit` `setWallpaper(bitmap: Bitmap)` `Unit` `setWallpaper(data: InputStream)` `Boolean` `shouldShowRequestPermissionRationale(permission: String)` `Unit` `startActivities(intents: Array<Intent>)` `Unit` `startActivities(intents: Array<Intent>, options: Bundle?)` `Unit` `startActivity(intent: Intent)` `Unit` `startActivity(intent: Intent, options: Bundle?)` `ComponentName?` `startForegroundService(service: Intent)` `Boolean` `startInstrumentation(
className: ComponentName,
profileFile: String?,
arguments: Bundle?
)` `Unit` `startIntentSender(
intent: IntentSender,
fillInIntent: Intent?,
flagsMask: Int,
flagsValues: Int,
extraFlags: Int
)` `Unit` `startIntentSender(
intent: IntentSender,
fillInIntent: Intent?,
flagsMask: Int,
flagsValues: Int,
extraFlags: Int,
options: Bundle?
)` `ComponentName?` `startService(service: Intent)` `Boolean` `stopService(name: Intent)` `Unit` `unbindService(conn: ServiceConnection)` `Unit` `unregisterComponentCallbacks(callback: ComponentCallbacks)` `Unit` `unregisterDeviceIdChangeListener(listener: IntConsumer)` `Unit` `unregisterReceiver(receiver: BroadcastReceiver)` `Unit` `updateServiceBindings(
params: MutableCollection<Context.UpdateBindingParams>
)` `Unit` `updateServiceGroup(conn: ServiceConnection, group: Int, importance: Int)` From [android.app.Service](https://developer.android.com/reference/android/app/Service.html) `Unit` `attachBaseContext(newBase: Context)` `Unit` `dump(fd: FileDescriptor, writer: PrintWriter, args: Array<String>)` `Unit` `onConfigurationChanged(newConfig: Configuration)` `Unit` `onCreate()` `Unit` `onLowMemory()` `Unit` `onRebind(intent: Intent)` `Unit` `onStart(intent: Intent, startId: Int)` `Int` `onStartCommand(intent: Intent, flags: Int, startId: Int)` `Unit` `onTaskRemoved(rootIntent: Intent)` `Unit` `onTimeout(startId: Int)` `Unit` `onTimeout(startId: Int, fgsType: Int)` `Unit` `onTrimMemory(level: Int)` `Boolean` `onUnbind(intent: Intent)` `Unit` `startForeground(id: Int, notification: Notification)` `Unit` `startForeground(
id: Int,
notification: Notification,
foregroundServiceType: Int
)` `Unit` `stopForeground(notificationBehavior: Int)` `Unit` `stopForeground(removeNotification: Boolean)` `Unit` `stopSelf()` `Unit` `stopSelf(startId: Int)` `Boolean` `stopSelfResult(startId: Int)`

### Inherited properties

From [android.content.Context](https://developer.android.com/reference/android/content/Context.md.txt) `open Context.BindServiceFlags` `updateableFlags` From [android.content.ContextWrapper](https://developer.android.com/reference/android/content/ContextWrapper.md.txt) `open Context` `applicationContext` `open ApplicationInfo` `applicationInfo` `open AssetManager` `assets` `open AttributionSource` `attributionSource` `open String?` `attributionTag` `open Context` `baseContext` `open File` `cacheDir` `open ClassLoader` `classLoader` `open File` `codeCacheDir` `open ContentResolver` `contentResolver` `open File` `dataDir` `open Int` `deviceId` `open Display` `display` `open File?` `externalCacheDir` `open Array<File>` `externalCacheDirs` `open Array<File>` `externalMediaDirs` `open File` `filesDir` `open Boolean` `isDeviceProtectedStorage` `open Boolean` `isRestricted` `open Boolean` `isUiContext` `open Executor` `mainExecutor` `open Looper` `mainLooper` `open File` `noBackupFilesDir` `open File` `obbDir` `open Array<File>` `obbDirs` `open String` `opPackageName` `open String` `packageCodePath` `open PackageManager` `packageManager` `open String` `packageName` `open String` `packageResourcePath` `open ContextParams?` `params` `open Resources` `resources` `open Resources.Theme` `theme` `open Drawable` `wallpaper`

**This property is deprecated.** Deprecated in Java
`open Int` `wallpaperDesiredMinimumHeight`

**This property is deprecated.** Deprecated in Java
`open Int` `wallpaperDesiredMinimumWidth`

**This property is deprecated.** Deprecated in Java
From [android.app.Service](https://developer.android.com/reference/android/app/Service.md.txt) `Application` `application` `Int` `foregroundServiceType`

## Public constructors

### SuspendingTimelineComplicationDataSourceService

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

```
SuspendingTimelineComplicationDataSourceService()
```

## Public functions

### onComplicationRequest

```
@UiThread
abstract suspend fun onComplicationRequest(request: ComplicationRequest): ComplicationDataTimeline?
```

Computes the `ComplicationDataTimeline` for the given `request`.

The `ComplicationDataTimeline` returned from this method will be passed to the `ComplicationDataSourceService.ComplicationRequestListener` provided to `onComplicationRequest`. Return `null` to indicate that the previous complication data timeline shouldn't be overwritten.

| See also |
|---|---|
| `onComplicationRequest` |   |
| `onComplicationData` |   |

### onComplicationRequest

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

```
final fun onComplicationRequest(
    request: ComplicationRequest,
    listener: ComplicationDataSourceService.ComplicationRequestListener
): Unit
```

Called when a complication data update is requested for the given complication id.

In response to this request the result callback should be called with the data to be displayed. If the request can not be fulfilled or no update is needed then null should be passed to the callback.

The callback doesn't have be called within onComplicationRequest but it should be called soon after. If this does not occur within around 20 seconds (exact timeout length subject to change), then the system will unbind from this service which may cause your eventual update to not be received. However if `ComplicationRequest.immediateResponseRequired` is `true` then provider should try to deliver the response in under 100 milliseconds, if `false` the deadline is 20 seconds. `ComplicationRequest.immediateResponseRequired` will only ever be `true` if `METADATA_KEY_IMMEDIATE_UPDATE_PERIOD_MILLISECONDS` is present in the manifest, and the provider has the privileged permission `com.google.android.wearable.permission.USE_IMMEDIATE_COMPLICATION_UPDATE`, and the complication is visible and non-ambient.

| Parameters |
|---|---|
| `request: ComplicationRequest` | The details about the complication that has been requested. |
| `listener: ComplicationDataSourceService.ComplicationRequestListener` | The callback to pass the result to the system. |

### onDestroy

```
open fun onDestroy(): Unit
```