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 IIMService

interface IIMService
Extends com.amazon.apmf.IStandard Provides functionality make keyboard service requests.

Methods

connect()

void connect(IConnectionListener* listener, IIMClientLooper? looper)
Requests a connection to the input method service. This is an async call. The specified listener is called if the connection established or an error occurs.

Parameters

listener
IConnectionListener* — Required A pointer to an instance of IConnectionListener listener.
looper
IIMClientLooper? — Optional A IIMClientLooper instance. If not provided, the IIMClient interfaces is invoked from an arbitrary implementation-supplied thread

disconnect()

void disconnect()
Disconnects from the input method service.

open()

void open(IIMClient* client, EditorInfo* editorInfo)
Opens the keyboard window. If the keyboard window is already open, it resets the keyboard with a newer editor or editorInfo instance.

Parameters

client
IIMClient* — Required The editor client.
editorInfo
EditorInfo* — Required The EditorInfo instance to associate with the keyboard service.

close()

void close()
Closes the keyboard window.

setSurroundingText()

void setSurroundingText(SurroundingText* surroundings)
Sets the surrounding text in the keyboard service.

Parameters

surroundings
SurroundingText* — Required A pointer to a SurroundingText object that contains the surround text.

setMirroringText()

void setMirroringText(IAttributedText* attrText, i32 bytesSelStart, i32 bytesSelEnd, i32 bytesStartOffset)
Sends the client editor’s text content as mirroring text to the keyboard window. Use this method only for full-screen keyboards. When the app is covered by the keyboard window, it syncs it’s text contents to keyboard so that the keyboard can present it to user. Because the keyboard window can typically only show one line of text, we don’t recommend that you sync large amounts of text content between application and keyboard.

Parameters

attrText
IAttributedText* — Required The text content with attributes to mirror.
bytesSelStart
i32 — Required The start of the selection.
bytesSelEnd
i32 — Required The end of the selection, which should be greater than or equal to start position.
bytesStartOffset
i32 — Required The offset of the attribute text within the text content.

updateSelection()

void updateSelection(i32 bytesSelStart, i32 bytesSelEnd)
Sets the text selection range in the keyboard service. Call this method only when the change is caused by the editor. For example, a changed caused by a copy and paste or the user manually moved the cursor. Don’t report change due keyboard setComposingText or commitText. Note that when the method is called the Keyboard service might reset its internal state for text predictions.

Parameters

bytesSelStart
i32 — Required The start of the selection range.
bytesSelEnd
i32 — Required The end of the selection range. This value must be greater than or equal to the start position.

showAppSuggestions()

void showAppSuggestions(Candidate*[] candidates)
Sends the app specific suggestion candidates to the keyboard service to present.

Parameters

candidates
Candidate*[] — Required a pointer to an array of type Candidate.

addInputUiListener()

void addInputUiListener(IInputUiListener* listener)
Registers the specified input UI listener.

Parameters

listener
IInputUiListener* — Required An instance of IInputUiListener.

removeInputUiListener()

void removeInputUiListener(IInputUiListener* listener)
Deregisters the specified input UI listener.

Parameters

listener
IInputUiListener* — Required The instance of IInputUiListener to deregister.

getInputUiStatus()

InputUiStatus* getInputUiStatus()
Gets the latest cached UI status received from keyboard service.

Returns

InputUiStatus* The instance of InputUiStatus that contains the status.

spellCheck()

void spellCheck(string str, i32 seqNum, ISpellCheckResultListener* listener)
Requests spell-checking on the specified string. Note that this is a stateless service. App can request spell-checking for non-active editor widgets.

Parameters

str
string — Required The string to spell-check.
seqNum
i32 — Required A sequence number for this request, the listener will receive spell check result along with the corresponding request’s sequence number.
listener
ISpellCheckResultListener* — Required The instance of ISpellCheckResultListener to recieve the results of the spell-check.
Last modified on October 29, 2026