Change Device Language via Adb

Adb shell command to change the device language?

I use the following to open locale settings in one of my applications:

final Intent intent = new Intent(Settings.ACTION_LOCALE_SETTINGS);
context.startActivity(intent);

The ACTION_LOCALE_SETTINGS constant is defined as follows:

public static final String ACTION_LOCALE_SETTINGS = "android.settings.LOCALE_SETTINGS";

So this should work:

adb shell am start -a android.settings.LOCALE_SETTINGS

Adb shell command can i use to open language settings directly?

For newer devices (3.0 and above) that use fragments, use:

adb shell am start -n com.android.settings/.Settings -e :android:show_fragment com.android.settings.LocalePicker

For older devices (2.3 and below) that don't use fragments, use:

adb shell am start -n com.android.settings/.LocalePicker

Also, for a reference you can just type adb into your terminal and it will display a list of commands that ADB supports. For the am command specifically, you can type adb shell am and it will display a list of options. In most cases if you do not specify any options for an ADB command, it will display help information for that command.

Changing the Android emulator locale automatically

Personally I think the simplest way is to start the emulator, probably a clean instance unless you are running integration tests that depends on other applications and then change locale using adb:

$ adb shell '
setprop persist.sys.language en;
setprop persist.sys.country GB;
stop;
sleep 5;
start'

or whatever locale you want to set.
To verify that your change was successful just use

$ adb shell 'getprop persist.sys.language'

You may also want to run emulators on know ports, check my answer in this thread.


Note that you can also set system properties directly when starting the emulator:

emulator -avd my_avd -prop persist.sys.language=en -prop persist.sys.country=GB

This way, you can create a plain old emulator of any type then start it up immediately using the locale of your choice, without first having to make any modifications to the emulator images.

This locale will persist for future runs of the emulator, though of course you can always change it again at startup or during runtime.

Change device language on Android 6.0 (Android M)

The SecurityException no longer exists on the public image of Android OS 6.0 (Marshmallow) version. This was confirmed on Nexus 6 and Nexus 9 devices. Case closed.

adb change developer settings options programmatically

You can use:

adb shell settings put global always_finish_activities 1 

To activate the setting and 0 to disable it.

You can find an official list of other available settings for android here.



Related Topics



Leave a reply



Submit