com.webos.service.ime

Note
This API has been available since API level 23.

API Summary

IME and Virtual Keyboard Service.

Overview of the API

This is a static service that starts with MaliitServer and provides access to the IME text field editor at a lower level than the VKB QML (since some languages have different VKBs).

For now, it primarily serves Second Screen, but it could provide other IME-related APIs in the future. The Second Screen functionality includes the ability to know when a text field is focused and the expected type of the input text, as well as inserting and replacing characters in the text field.

Text manipulation using this API is handled exclusively in Unicode characters. The encoding for LS2 is UTF-8, but length and count parameters should be based on Unicode characters. The manipulation is independent of language or keyboard layout.

Methods

deleteCharacters

ACG: ime.operation
  • Added: API level 23

Description

Deletes characters from the current insertion point.

Parameters

Name

Required

Type

Description

countRequirednumberNumber of Unicode characters to delete.

Call Returns

Name

Required

Type

Description

returnValueRequiredBooleantrue if successful, false otherwise.
errorTextOptionalString

Indicates the reason for the failure of the operation.

errorCodeOptionalNumber (int32_t)

Indicates the number for the failure of the operation.

Example

Example code

# luna-send -n 1 luna://com.webos.service.ime/deleteCharacters '{"count": 1}'

insertText

ACG: ime.operation
  • Added: API level 23

Description

Inserts text at the current insertion point, or replaces all text in the field.

Parameters

Name

Required

Type

Description

textRequiredStringText to insert.
replaceOptionalBooleanif true, replace any existing text in field.

Call Returns

Name

Required

Type

Description

returnValueRequiredBooleantrue if successful, false otherwise.
errorTextOptionalString

Indicates the reason for the failure of the operation.

errorCodeOptionalNumber (int32_t)

Indicates the number for the failure of the operation.

Example

Example code

# luna-send -n 1 luna://com.webos.service.ime/insertText '{"text": "hello world", "replace": true}'

registerRemoteKeyboard

ACG: ime.operation
  • Added: API level 23

Description

Allows subscribing to information about the current text field. When a text field is selected or updated, an update will be sent out to any subscribers with information about the text field.

Parameters

Name

Required

Type

Description

subscribeRequiredBooleanMust be true.

Call Returns

Name

Required

Type

Description

returnValueRequiredBooleantrue if successful, false otherwise.
subscribedOptionalBooleanSubscribed to service.
errorTextOptionalString

Indicates the reason for the failure of the operation.

errorCodeOptionalNumber (int32_t)

Indicates the number for the failure of the operation.

Subscription Returns

Name

Required

Type

Description

focusChangedRequiredBooleantrue if a different text field was selected/focused
currentWidgetOptionalobjectAn object with properties describing the current text field, including the boolean values "focus", "correctionEnabled", "predictionEnabled", "autoCapitalizationEnabled", "hiddenText", "hasSurroundingText", "hasSelection", and the integer values "cursorPosition" (Unicode offset of cursor) and "surroundingTextLength" (Unicode length of field contents, if available)

Example

Example code

# luna-send -n 1 luna://com.webos.service.ime/registerRemoteKeyboard '{"subscribe": true}'

sendEnterKey

ACG: ime.operation
  • Added: API level 23

Description

Sends the enter key in the current field.

Parameters

None

Call Returns

Name

Required

Type

Description

returnValueRequiredBooleantrue if successful, false otherwise.

Example

Example code

# luna-send -n 1 luna://com.webos.service.ime/sendEnterKey '{}'

Contents