Starting with image version 25.07, Cloud Phone supports local input methods, which can provide a better typing experience than the cloud phone built-in input method in some scenarios. This guide applies to the Cloud Phone Matrix Edition.
Input method comparison
A local input method is installed on your local device. This device runs the Alibaba Cloud Workspace client or uses an SDK to display the Cloud Phone screen. You type on your local device, and the text appears in the Cloud Phone instance.
Local input methods and the Cloud Phone built-in input method each have advantages and disadvantages, making them suitable for different use cases. The following table compares them.
Comparison item | Cloud Phone built-in input method | Local input method | |
Advantages |
|
| |
Disadvantages |
|
| |
Methods to switch input source
Use one of the following methods to switch input source. These methods apply to the Cloud Phone Matrix Edition.
ADB
First-time enable
When you first create a Cloud Phone instance, enable the built-in input method.
adb shell settings put secure enabled_input_methods "com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME:com.wuying.wyime/.PseudoImeService"Switch to the local input method
adb shell ime set com.wuying.wyime/.PseudoImeServiceSwitch to the Cloud Phone built-in input method
This example involves the pre-installed Gboard input method. Switch to other input methods in a similar way.
adb shell ime set com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIMEWeb SDK
Get the latest SDK (to use local input methods) and demo. For more information, see Web SDK.
Specify the following parameter when you connect.
config.useCustomIme=trueThen, follow the regular connection procedure. For more information, see the demo.
Android SDK
To enable the local Input Method Editor (IME) with the Android SDK, you must listen for connection status callbacks from the ASP Engine before the StreamView connects. Once the "connection successful" callback is received, set the local IME to its enabled state within that callback.
Get the latest SDK (to use local input methods) and demo. For more information, see Android SDK.
@Override
public void onCreate() {
super.onCreate();
IASPEngineListener listener = new IASPEngineListener() {
@Override
public void onConnectionSuccess(int connectionId) {
mStreamView.getASPEngineDelegate().setImeType(ASPIMEType.ASP_IME_TYPE_LOCAL);
mStreamView.shouldProactivelyShowIME(true);
}
/* Note: You also need to implement other interfaces. */
}
StreamView streamView = findViewById(R.id.stream_view);
streamView.getASPEngineDelegate().registerASPEngineListener(listener);
/* Other onCreate procedures */
}Windows SDK
Windows does not have a unified graphical user interface (GUI) application framework. Therefore, the Windows SDK provides only basic status callbacks and upstream interfaces. You must handle the interaction with the input method during integration.
To use a local input method on Windows, follow these steps:
Implement the AspIme object to accept the
onImeFocusUpdatecallback.When you create the AspClient, call
setAspImeto register the AspIme object.When
onImeFocusUpdate(true, false)is called, invoke the input method logic for the corresponding UI framework.When
onImeFocusUpdate(false, false)is called, hide the input method for the corresponding UI framework.When the input method submits characters, call the
AspClient::setImeCommitmethod to submit the input.
Different GUI frameworks use different interfaces to interact with input methods. The following are the interfaces for common frameworks:
Qt framework
To invoke the input method:
setAttribute(Qt::WA_InputMethodEnabled, true);To retrieve input content: Use the
void inputMethodEvent(QInputMethodEvent *event) override;callback.
WPF framework
To invoke the input method: Implement
System.Windows.Interop.IKeyboardInputSink.To retrieve input content: Implement
public bool TranslateChar(ref MSG msg, ModifierKeys modifiers);.