Adb shell 命令更改设备语言?

and*_*epm 0 android automated-tests adb appium

我是 Android 自动化领域的新手,我一直在研究 adb 命令来帮助我在物理设备上进行测试。

有没有办法通过 adb 更改被测设备的语言?

我找到了下面的命令:

adb shell am start -n com.android.settings/.Settings -e :android:show_fragment com.android.settings.LocalePicker
Run Code Online (Sandbox Code Playgroud)

没有工作。我还通过 shell 尝试过:

adb shell setprop persist.sys.language pt
Run Code Online (Sandbox Code Playgroud)

但它也没有奏效。

Cor*_*ton 5

我使用以下命令在我的应用程序之一中打开区域设置:

final Intent intent = new Intent(Settings.ACTION_LOCALE_SETTINGS);
context.startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

ACTION_LOCALE_SETTINGS常数定义如下:

public static final String ACTION_LOCALE_SETTINGS = "android.settings.LOCALE_SETTINGS";
Run Code Online (Sandbox Code Playgroud)

所以这应该有效:

adb shell am start -a android.settings.LOCALE_SETTINGS
Run Code Online (Sandbox Code Playgroud)