# PlatformTextInputMethodRequest

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/PlatformTextInputMethodRequest.+class:androidx.compose.ui.platform.PlatformTextInputMethodRequest) Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.6.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface PlatformTextInputMethodRequest
  ```
- android

  ```
  fun interface PlatformTextInputMethodRequest
  ```

*** ** * ** ***

Represents a request to open a platform-specific text input session via `PlatformTextInputModifierNode.textInputSession`.

## Summary

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/android/view/inputmethod/InputConnection.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/PlatformTextInputMethodRequest#createInputConnection(android.view.inputmethod.EditorInfo)(outAttributes: https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html)` Called when the platform requests an `https://developer.android.com/reference/android/view/inputmethod/InputConnection.html` via `https://developer.android.com/reference/android/view/View.html#onCreateInputConnection(android.view.inputmethod.EditorInfo)`. | android |

## Public functions

### createInputConnection

android Added in [1.6.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.6.0)

```
fun createInputConnection(outAttributes: EditorInfo): InputConnection
```

Called when the platform requests an `https://developer.android.com/reference/android/view/inputmethod/InputConnection.html` via `https://developer.android.com/reference/android/view/View.html#onCreateInputConnection(android.view.inputmethod.EditorInfo)`.

This method makes relatively stricter ordering guarantees about the lifetime of the returned `https://developer.android.com/reference/android/view/inputmethod/InputConnection.html` than Android does, to make working with connections simpler. Namely, it guarantees:

- References to an `https://developer.android.com/reference/android/view/inputmethod/InputConnection.html` will be cleared as soon as the connection get closed via `https://developer.android.com/reference/android/view/inputmethod/InputConnection.html#closeConnection()`. Even if Android leaks its reference to the connection, the connection returned from this method will not be leaked.

However it does not guarantee that only one `https://developer.android.com/reference/android/view/inputmethod/InputConnection.html` will ever be active at a time for a given `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/PlatformTextInputMethodRequest` instance. On the other hand Android platform does guarantee that even though the platform may create multiple `https://developer.android.com/reference/android/view/inputmethod/InputConnection.html`s, only one of them will ever communicate with the app, invalidating any other `https://developer.android.com/reference/android/view/inputmethod/InputConnection.html` that remained open at the time of communication.

Android may call `https://developer.android.com/reference/android/view/View.html#onCreateInputConnection(android.view.inputmethod.EditorInfo)` multiple times for the same session -- each system call will result in a 1:1 call to this method. Unfortunately Android platform may decide to use an earlier `https://developer.android.com/reference/android/view/inputmethod/InputConnection.html` returned from this function, invalidating the ones that were created later. Please do not rely on the order of calls to this function.

| Parameters |
|---|---|
| `outAttributes: https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html` | The `https://developer.android.com/reference/android/view/inputmethod/EditorInfo.html` from `https://developer.android.com/reference/android/view/View.html#onCreateInputConnection(android.view.inputmethod.EditorInfo)`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/view/inputmethod/InputConnection.html` | The `https://developer.android.com/reference/android/view/inputmethod/InputConnection.html` that will be used to talk to the IME as long as the session is active. This connection will not receive any calls after the requesting coroutine is cancelled. |