# TextInputService

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

  ```
  open class TextInputService
  ```

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> Use PlatformTextInputModifierNode instead.

Handles communication with the IME. Informs about the IME changes via `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/EditCommand`s and provides utilities for working with software keyboard.

This class is responsible for ensuring there is only one open `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputSession` which will interact with software keyboards. Start new a TextInputSession by calling `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#startInput(androidx.compose.ui.text.input.TextFieldValue,androidx.compose.ui.text.input.ImeOptions,kotlin.Function1,kotlin.Function1)` and close it with `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#stopInput(androidx.compose.ui.text.input.TextInputSession)`.

## Summary

| ### Public constructors |
|---|---|
| `[TextInputService](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#TextInputService(androidx.compose.ui.text.input.PlatformTextInputService))(platformTextInputService: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/PlatformTextInputService)` **This function is deprecated.** Use PlatformTextInputModifierNode instead. | Cmn |

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[hideSoftwareKeyboard](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#hideSoftwareKeyboard())()` **This function is deprecated.** Use SoftwareKeyboardController.hide or TextInputSession.hideSoftwareKeyboard instead. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[showSoftwareKeyboard](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#showSoftwareKeyboard())()` **This function is deprecated.** Use SoftwareKeyboardController.show or TextInputSession.showSoftwareKeyboard instead. | Cmn |
| `open https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputSession` | `[startInput](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#startInput(androidx.compose.ui.text.input.TextFieldValue,androidx.compose.ui.text.input.ImeOptions,kotlin.Function1,kotlin.Function1))( value: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextFieldValue, imeOptions: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/ImeOptions, onEditCommand: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/EditCommand>) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, onImeActionPerformed: (https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/ImeAction) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` **This function is deprecated.** Use PlatformTextInputModifierNode instead. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[stopInput](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#stopInput(androidx.compose.ui.text.input.TextInputSession))(session: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputSession)` **This function is deprecated.** Use PlatformTextInputModifierNode instead. | Cmn |

## Public constructors

### TextInputService

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

```
[TextInputService](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#TextInputService(androidx.compose.ui.text.input.PlatformTextInputService))(platformTextInputService: PlatformTextInputService)
```

> [!CAUTION]
> **This function is deprecated.**   
> Use PlatformTextInputModifierNode instead.

## Public functions

### hideSoftwareKeyboard

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

```
fun [hideSoftwareKeyboard](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#hideSoftwareKeyboard())(): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> Use SoftwareKeyboardController.hide or TextInputSession.hideSoftwareKeyboard instead, use this instead:
>
> ```kotlin
> textInputSession.hideSoftwareKeyboard()
> ```

Hide onscreen keyboard.

### showSoftwareKeyboard

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

```
fun [showSoftwareKeyboard](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#showSoftwareKeyboard())(): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> Use SoftwareKeyboardController.show or TextInputSession.showSoftwareKeyboard instead, use this instead:
>
> ```kotlin
> textInputSession.showSoftwareKeyboard()
> ```

Request showing onscreen keyboard.

This call will be ignored if there is not an open `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputSession`, as it means there is nothing that will accept typed input. The most common way to open a TextInputSession is to set the focus to an editable text composable.

There is no guarantee that the keyboard will be shown. The software keyboard or system service may silently ignore this request.

### startInput

Cmn

```
open fun [startInput](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#startInput(androidx.compose.ui.text.input.TextFieldValue,androidx.compose.ui.text.input.ImeOptions,kotlin.Function1,kotlin.Function1))(
    value: TextFieldValue,
    imeOptions: ImeOptions,
    onEditCommand: (List<EditCommand>) -> Unit,
    onImeActionPerformed: (ImeAction) -> Unit
): TextInputSession
```

> [!CAUTION]
> **This function is deprecated.**   
> Use PlatformTextInputModifierNode instead.

Start text input session for given client.

If there is a previous `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputSession` open, it will immediately be closed by this call to `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#startInput(androidx.compose.ui.text.input.TextFieldValue,androidx.compose.ui.text.input.ImeOptions,kotlin.Function1,kotlin.Function1)`.

| Parameters |
|---|---|
| `value: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextFieldValue` | initial `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextFieldValue` |
| `imeOptions: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/ImeOptions` | IME configuration |
| `onEditCommand: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/EditCommand>) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | callback to inform about changes requested by IME |
| `onImeActionPerformed: (https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/ImeAction) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | callback to inform if an IME action such as `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/ImeAction#Done()` etc occurred. |

### stopInput

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

```
open fun [stopInput](https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#stopInput(androidx.compose.ui.text.input.TextInputSession))(session: TextInputSession): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> Use PlatformTextInputModifierNode instead.

Stop text input session.

If the `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#stopInput(androidx.compose.ui.text.input.TextInputSession)` is not the currently open session, no action will occur.

| Parameters |
|---|---|
| `session: https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputSession` | the session returned by `https://developer.android.com/reference/kotlin/androidx/compose/ui/text/input/TextInputService#startInput(androidx.compose.ui.text.input.TextFieldValue,androidx.compose.ui.text.input.ImeOptions,kotlin.Function1,kotlin.Function1)` call. |