Search code examples
androidshelladb

How to reset Google Keyboard language using adb


So I have to add an automation step where in the keyboard language needs to be reset in case someone changes it.

Have used adb for this and works well on Samsung phones but doesn't work on Moto X and Nexus phones.

The adb command I use is adb shell pm clear com.google.android.inputmethod.latin for Moto X and Nexus phones. This doesn't have the desired effect.

For Samsung phones, the command is adb shell pm clear com.sec.android.inputmethod. This works well.

Anyone can help? The only constraint is that we cannot root the phone.


Solution

  • The command doesn't work for Google Keyboard because the selected languages are not saved in the preference of the app, as the Samsung Keyboard, but in the key ENABLED_INPUT_METHODS of the Settings.Secure table.

    You can reset the selected languages of Google Keyboard with this command:

    adb shell settings put secure enabled_input_methods com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME