---
title: "PlatformTextInputMethodRequest"
description: "Represents a request to open a platform-specific text input session via
`PlatformTextInputModifierNode.textInputSession`."
type: "interface"
---

<div class='type'>Interface</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>



```kotlin
expect interface PlatformTextInputMethodRequest
```


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



<div class='sourceset sourceset-android'>Android</div>



```kotlin
actual fun interface PlatformTextInputMethodRequest
```


Represents a request to open an Android text input session via
`PlatformTextInputSession.startInputMethod`.


## Functions

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


Called when the platform requests an `InputConnection` via `View.onCreateInputConnection`.

This method makes relatively stricter ordering guarantees about the lifetime of the returned
`InputConnection` than Android does, to make working with connections simpler. Namely, it
guarantees:
- References to an `InputConnection` will be cleared as soon as the connection get closed via `InputConnection.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 `InputConnection` will ever be active at a time
for a given `PlatformTextInputMethodRequest` instance. On the other hand Android platform
does guarantee that even though the platform may create multiple `InputConnection`s, only one
of them will ever communicate with the app, invalidating any other `InputConnection` that
remained open at the time of communication.

Android may call `View.onCreateInputConnection` 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 `InputConnection` 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 | The `EditorInfo` from `View.onCreateInputConnection`. |


#### Returns

| | |
| --- | --- |
|  | The `InputConnection` 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. |




