# PropagationToken

Artifact: [androidx.tracing:tracing](https://developer.android.com/jetpack/androidx/releases/tracing) [View Source](https://cs.android.com/search?q=file:androidx/tracing/PropagationToken.kt+class:androidx.tracing.PropagationToken) Added in [2.0.5](https://developer.android.com/jetpack/androidx/releases/tracing#2.0.5)

*** ** * ** ***

Android/JVM
- android

  ```
  interface PropagationToken
  ```
Known direct subclasses [PlatformThreadContextElement](https://developer.android.com/reference/kotlin/androidx/tracing/PlatformThreadContextElement), [PropagationUnsupportedToken](https://developer.android.com/reference/kotlin/androidx/tracing/PropagationUnsupportedToken)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/tracing/PlatformThreadContextElement` | We use the `https://developer.android.com/reference/kotlin/androidx/tracing/PlatformThreadContextElement` construct to know when a coroutine has suspended, and about to resume on a `Thread`. |
| `https://developer.android.com/reference/kotlin/androidx/tracing/PropagationUnsupportedToken` | The `https://developer.android.com/reference/kotlin/androidx/tracing/PropagationToken` instance that should be returned when context propagation is unsupported by the underlying `https://developer.android.com/reference/kotlin/androidx/tracing/Tracer`. |

*** ** * ** ***

A token representing state carried forward for context propagation.

This interface is only useful for libraries that want to bring their own implementation of context propagation.

## Summary

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-element/index.html?` | `@https://developer.android.com/reference/kotlin/androidx/tracing/DelicateTracingApi https://developer.android.com/reference/kotlin/androidx/tracing/PropagationToken#contextElementOrNull()()` | android |

## Public functions

### contextElementOrNull

android Added in [2.0.5](https://developer.android.com/jetpack/androidx/releases/tracing#2.0.5)

```
@DelicateTracingApi
fun contextElementOrNull(): CoroutineContext.Element?
```

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-element/index.html?` | a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-coroutine-context/-element/index.html` that needs to be installed in the `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/index.html` prior to dispatching the suspending block of code being traced; if the token is being used in a suspending context. |