Starting with Cloud Phone image version 25.07, Cloud Phone supports using your local input method. In some scenarios, this provides a better typing experience than the Cloud Phone built-in input method. This guide applies to the Cloud Phone Matrix Edition.
Input method comparison
A local input method is one installed on the local device that runs the Alibaba Cloud Workspace client or uses an SDK to access the Cloud Phone screen. You type on your local device, and the input is processed and displayed in the Cloud Phone instance.
The following table compares local input methods with the Cloud Phone built-in input method.
|
Comparison item |
Cloud Phone built-in input method |
Local input method |
|
|
Advantages |
|
|
|
|
Disadvantages |
|
|
|
Input method switching
You can switch between input methods as needed. The following methods apply to the Cloud Phone Matrix Edition.
ADB
Initial setup
When you first create a Cloud Phone instance, enable the Cloud Phone 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 local input method
adb shell ime set com.wuying.wyime/.PseudoImeService
Switch to built-in input method
This example uses the pre-installed Gboard input method on the Cloud Phone. You can replace it with another input method.
adb shell ime set com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME
Web SDK
Get the latest SDK (to support local input methods) and demo. For more information, see Web SDK.
-
Specify the following parameter when you connect.
config.useCustomIme=true -
Then, follow the standard connection procedure. For details, refer to the demo.
Android SDK
To enable the local input method in the Android SDK, register a connection status listener on the ASP Engine before the StreamView connects, and then enable the local input method in the successful connection callback.
Get the latest SDK (to support 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 must also implement other interfaces. */
}
StreamView streamView = findViewById(R.id.stream_view);
streamView.getASPEngineDelegate().registerASPEngineListener(listener);
/* Other onCreate procedures */
}
Windows SDK
Because Windows lacks a unified GUI application framework, the Windows SDK provides only basic status callbacks and upstream interfaces. You must implement the input method interaction logic yourself.
Using a local input method on Windows involves the following steps:
-
Implement the AspIme object to receive the
onImeFocusUpdatecallback. -
When you create the AspClient, call
setAspImeto register the AspIme object. -
When
onImeFocusUpdate(true, false)is called, activate the input method for the corresponding UI framework. -
When
onImeFocusUpdate(false, false)is called, hide the input method for the corresponding UI framework. -
When the input method commits characters, call the
AspClient::setImeCommitmethod to submit the input.
Each GUI framework uses its own interface to interact with input methods. The following are common examples:
-
Qt framework
-
To activate the input method:
setAttribute(Qt::WA_InputMethodEnabled, true); -
To get the input content: Use the
void inputMethodEvent(QInputMethodEvent *event) override;callback.
-
-
WPF framework
-
To activate the input method: Implement
System.Windows.Interop.IKeyboardInputSink. -
To get the input content: Implement
public bool TranslateChar(ref MSG msg, ModifierKeys modifiers);.
-