Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support
Native
Skip to main content

Interface IIMClient

interface IIMClient
Extends com.amazon.apmf.IStandard Provides callbacks to receive the editing requests and callbacks made by the keyboard service.

Methods

setComposingText()

void setComposingText(string text)
Sets the style for the specified composing text. Typically, the editor renders the text with an underline style. The new composing text overwrites any existing composing text.

Parameters

text
string — Required The composing text.

setAttributedComposingText()

void setAttributedComposingText(IAttributedText* attrText)
Sets the specified attribues for the composing text. The editor then renders the text with attributes. The new composing text overwrite any existing composing text if any.

Parameters

attrText
IAttributedText* — Required Composing text with attributes.

commitText()

void commitText(string text)
Commits the specified text to the text editor. The commit text will dismiss the composing text if any, and commit the string into text editor.

Parameters

text
string — Required The commit text

setComposingRegion()

void setComposingRegion(i32 bytesBefore, i32 bytesAfter)
Sets the composing region to the specified range. Setting the range commits the existing composing text and sets a new composing text with the specified range.

Parameters

bytesBefore
i32 — Required The number of bytes of text before the cursor.
bytesAfter
i32 — Required The number bytes of text after the cursor.

finishComposingText()

void finishComposingText()
Commits the current composing text.

getSurroundingText()

SurroundingText* getSurroundingText(i32 maxBytesBefore, i32 maxBytesAfter)
Gets the text before and after the cursor to use for contextual word prediction. The text editor only returns as much surrounding text as is necessary to complete the predicion up to the maxium amount of text specified. This is typically a paragraph of text. Note that the editor might not have contextual capability or might return empty surrounding text.

Parameters

maxBytesBefore
i32 — Required The maximum length of text, in bytes, before cursor (typically 1K).
maxBytesAfter
i32 — Required The maximum length of text, in bytes, after cursor (typically 1K).

Returns

SurroundingText* An instance of SurroundingText.

deleteSurroundingText()

void deleteSurroundingText(i32 bytesBefore, i32 bytesAfter)
Deletes the specified amount of text before and after the cursor.

Parameters

bytesBefore
i32 — Required The length of text, in bytes, before cursor.
bytesAfter
i32 — Required The length of text, in bytes, after cursor.

setSelection()

void setSelection(i32 bytesSelStart, i32 bytesSelEnd)
Sets the selection to the specified range. If the range is zero-length, it removes any existing selection and sets the cursor to the positions specified by bytesSelStart and bytesSelEnd.

Parameters

bytesSelStart
i32 — Required The start position of the selection.
bytesSelEnd
i32 — Required The end position of the selection.

performEditorAction()

void performEditorAction(InputAction action)
Perform the the specified editor action. Typically, you will pass the value of the inputAction field in your EditorInfo instance. The keyboard service might also define a private action code which has been agreed upon between the client app and keyboard, and might use this method for certain input interactions.

Parameters

action
InputAction — Required The action to perform in the client app editor.
Last modified on October 29, 2026