Note: the commands in this solution requires adb setup in PC and the solution is tested on Android 4.2.1, 5.0.2 and 5.1.1.
If you don't have any keyboard app installed in the system, then either use web version of Play Store to remotely install a keyboard app in your system (requires active internet connection in your device) or obtain the APK of your keyboard from somewhere somehow and install it in your system. You may either install it:
Once the app is setup, execute this command on PC:
adb shell ime list -a
It will list all the available (enabled or not) IME (Input Method) services in your system.
Demo output:
com.android.inputmethod.latin/.LatinIME:
mId=com.android.inputmethod.latin/.LatinIME mSettingsActivityName=com.android.inputmethod.latin.settings.SettingsActivity
mIsDefaultResId=0x7f070000
Service:
priority=0 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=false
ServiceInfo:
name=com.android.inputmethod.latin.LatinIME
packageName=com.android.inputmethod.latin
labelRes=0x7f08003a nonLocalizedLabel=null icon=0x0 banner=0x0
enabled=true exported=true processName=com.android.inputmethod.latin
permission=android.permission.BIND_INPUT_METHOD
flags=0x0
net.zhdev.ctrlvkeyboard/.CtrlVKeyboard:
mId=net.zhdev.ctrlvkeyboard/.CtrlVKeyboard mSettingsActivityName=null
mIsDefaultResId=0x0
Service:
priority=0 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=false
ServiceInfo:
name=net.zhdev.ctrlvkeyboard.CtrlVKeyboard
packageName=net.zhdev.ctrlvkeyboard
labelRes=0x7f0b0015 nonLocalizedLabel=null icon=0x0 banner=0x0
enabled=true exported=true processName=net.zhdev.ctrlvkeyboard
permission=android.permission.BIND_INPUT_METHOD
flags=0x0
com.touchtype.swiftkey/com.touchtype.KeyboardService:
mId=com.touchtype.swiftkey/com.touchtype.KeyboardService mSettingsActivityName=com.touchtype.settings.TouchTypeKeyboardSettings
mIsDefaultResId=0x0
Service:
priority=0 preferredOrder=0 match=0x108000 specificIndex=-1 isDefault=false
ServiceInfo:
name=com.touchtype.KeyboardService
packageName=com.touchtype.swiftkey
enabled=true exported=true processName=com.touchtype.swiftkey
permission=android.permission.BIND_INPUT_METHOD
flags=0x0
The highlighted strings next to mId=
are the IDs of the keyboard apps available in my system.
In any ID, the string before /
is the package name of the keyboard app. Example: for Swiftkey keyboard, the mId is:
com.touchtype.swiftkey/com.touchtype.KeyboardService
The string com.touchtype.swiftkey
is the package name of Swiftkey app. Package name is what will help you to find the appropriate mID that you should use to enable a particular keyboard app.
To know the package name of an app, follow View app's full package name?
Once you've the appropriate ID, use it to make your app the default keyboard in your system. Do:
# Note that it doesn't matter whether the IME is added into enabled input methods or not. Consider this a direct override.
# Replace ID with mId of your keyboard app
adb shell settings put secure default_input_method "ID"
adb shell content update --uri content://settings/secure --bind value:s:"ID" --where "name='default_input_method'" # alternative to above command
adb reboot # optional
Try opening an app which requires input from a keyboard. You would be seeing your keyboard app.
(Click image to enlarge; courtesy of OP)
