Interface IIMService
interface IIMService
Extends com.amazon.apmf.IStandard
Provides functionality make keyboard service requests.
Methods
connect()
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.voidconnect(IConnectionListener*listener,IIMClientLooper?looper)
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()
Opens the keyboard window. If the keyboard window is already open, it resets the keyboard with a newervoidopen(IIMClient*client,EditorInfo*editorInfo)
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()
Sets the surrounding text in the keyboard service.voidsetSurroundingText(SurroundingText*surroundings)
Parameters
surroundings
SurroundingText* — Required
A pointer to a SurroundingText object that contains the surround text.
setMirroringText()
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.voidsetMirroringText(IAttributedText*attrText,i32bytesSelStart,i32bytesSelEnd,i32bytesStartOffset)
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()
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 keyboardvoidupdateSelection(i32bytesSelStart,i32bytesSelEnd)
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()
Sends the app specific suggestion candidates to the keyboard service to present.voidshowAppSuggestions(Candidate*[]candidates)
Parameters
candidates
Candidate*[] — Required
a pointer to an array of type Candidate.
addInputUiListener()
Registers the specified input UI listener.voidaddInputUiListener(IInputUiListener*listener)
Parameters
listener
IInputUiListener* — Required
An instance of IInputUiListener.
removeInputUiListener()
Deregisters the specified input UI listener.voidremoveInputUiListener(IInputUiListener*listener)
Parameters
listener
IInputUiListener* — Required
The instance of IInputUiListener to deregister.
getInputUiStatus()
Gets the latest cached UI status received from keyboard service.InputUiStatus*getInputUiStatus()
Returns
InputUiStatus*
The instance of InputUiStatus that contains the status.
spellCheck()
Requests spell-checking on the specified string. Note that this is a stateless service. App can request spell-checking for non-active editor widgets.voidspellCheck(stringstr,i32seqNum,ISpellCheckResultListener*listener)
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.

