Starting with image version 25.07, Cloud Phone supports local input methods, which can provide a better typing experience than the built-in input method in some scenarios.
Input method comparison
A local input method is installed on your local device. This device runs the Cloud Phone 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 built-in Cloud Phone input method each have advantages and disadvantages, making them suitable for different scenarios. The following table compares them.
Comparison item | Built-in Cloud Phone input method | Local input method | |
Advantages |
|
| |
Disadvantages |
|
| |
Methods to switch input methods
You can switch input methods as needed.
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 built-in Cloud Phone input method
This example uses the pre-installed Gboard input method. You can replace it with another input method.
adb shell ime set com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIMEWeb SDK
Obtain the latest SDK and demo to use local input methods. For more information, see Web SDK.
Specify the following parameter when you connect.
config.useCustomIme=trueThen, follow the standard connection procedure. For more information, see the demo.
Android SDK
To enable the local input method with the Android SDK, listen for the connection status callback from the ASP Engine before StreamView connects. Then, enable the local input method in the successful connection callback.
Obtain the latest SDK and demo to use local input methods. 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 a character, 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);.