# PlatformTextInputInterceptor

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/platform/PlatformTextInputModifierNode.kt+class:androidx.compose.ui.platform.PlatformTextInputInterceptor) Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.7.0) Common/AllAndroid/JVM
- Cmn

  ```
  fun interface PlatformTextInputInterceptor
  ```

*** ** * ** ***

Single-function interface passed to `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/InterceptPlatformTextInput.composable#InterceptPlatformTextInput(androidx.compose.ui.platform.PlatformTextInputInterceptor,kotlin.Function0)`.

## Summary

| ### Public functions |
|---|---|---|
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-nothing/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/PlatformTextInputInterceptor#interceptStartInputMethod(androidx.compose.ui.platform.PlatformTextInputMethodRequest,androidx.compose.ui.platform.PlatformTextInputSession)( request: https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/PlatformTextInputMethodRequest, nextHandler: https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/PlatformTextInputSession )` Called when a function passed to `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/package-summary#(androidx.compose.ui.platform.PlatformTextInputModifierNode).establishTextInputSession(kotlin.coroutines.SuspendFunction1)` calls `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/PlatformTextInputSession#startInputMethod(androidx.compose.ui.platform.PlatformTextInputMethodRequest)`. | Cmn |

## Public functions

### interceptStartInputMethod

Cmn

```
suspend fun interceptStartInputMethod(
    request: PlatformTextInputMethodRequest,
    nextHandler: PlatformTextInputSession
): Nothing
```

Called when a function passed to `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/package-summary#(androidx.compose.ui.platform.PlatformTextInputModifierNode).establishTextInputSession(kotlin.coroutines.SuspendFunction1)` calls `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/PlatformTextInputSession#startInputMethod(androidx.compose.ui.platform.PlatformTextInputMethodRequest)`. The `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/PlatformTextInputMethodRequest` from the caller is passed to this function as `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/PlatformTextInputInterceptor#interceptStartInputMethod(androidx.compose.ui.platform.PlatformTextInputMethodRequest,androidx.compose.ui.platform.PlatformTextInputSession)`, and this function can either respond to the request directly (e.g. recording it for a test), or wrap the request and pass it to `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/PlatformTextInputInterceptor#interceptStartInputMethod(androidx.compose.ui.platform.PlatformTextInputMethodRequest,androidx.compose.ui.platform.PlatformTextInputSession)`. This function *must* call into `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/PlatformTextInputInterceptor#interceptStartInputMethod(androidx.compose.ui.platform.PlatformTextInputMethodRequest,androidx.compose.ui.platform.PlatformTextInputSession)` if it intends for the system to respond to the request. Not calling into `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/PlatformTextInputInterceptor#interceptStartInputMethod(androidx.compose.ui.platform.PlatformTextInputMethodRequest,androidx.compose.ui.platform.PlatformTextInputSession)` has the effect of blocking the request.

This method has the same ordering guarantees as `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/PlatformTextInputSession#startInputMethod(androidx.compose.ui.platform.PlatformTextInputMethodRequest)`. That is, for a given text input modifier, if `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/PlatformTextInputSession#startInputMethod(androidx.compose.ui.platform.PlatformTextInputMethodRequest)` is called multiple times, only one `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/PlatformTextInputInterceptor#interceptStartInputMethod(androidx.compose.ui.platform.PlatformTextInputMethodRequest,androidx.compose.ui.platform.PlatformTextInputSession)` call will be made at a time, and any previous call will be allowed to finish running any `finally` blocks before the new session starts.