EMDK Power Tip: Setting the Default Keyboard

Anonymous (not verified) -
3 MIN READ
13

So the stock Android keyboard just isn't cutting it for you? The good news is that you don't have to settle for the stock keyboard. For those of you developing for a Zebra Android device that has GMS, it's a simple Google Play search for "soft keyboard" to turn up a great number of replacements.  If you don't have Google Play as an option, the Amazon App Store is a great alternative. Of course, you can always search the web for an "android soft keyboard apk". Download an APK from a reputable site and side load it.

 

Now you have a great new keyboard with big buttons, or gestures that make input a snap, but when you tap on a text field it's still that same old stock keyboard that pops up. This happens until you tell Android that you want the new keyboard to be the default keyboard, so it will pop up instead. To change the default keyboard, go into Settings > Language & Input > Default and select the new keyboard.

 

Now you are all set on a single device. What if you have a hundred devices to install this great new keyboard on? The manual process of installing the apk and touching your way through the settings menu will take quite a bit of time. In many cases, you would employ a device staging tool like StageNow, or an MDM to install the keyboard apk and set the default keyboard.  If a staging tool or an MDM is not an option, then the EMDK may just have a solution for you. With the EMDK Profile Manager and ProfileManger APIs, you can create an app that will install your APK and set it as the default keyboard.

 

Creating a project that uses Profile Manager to submit a profile has been covered multiple times in the EMDK Documentation, so I will just jump straight to setting up the profile.  If you have not been through one yet, I would suggest starting with the Clock Manager Tutorial, it covers all the basics needed to submit a profile.

 

In Profile Manager create a new Profile named "KeyboardProfile-1"

KeyboardProfile-1.png

 

Now add Profile Features App Manager and UI Manager

If you have installed the keyboard through the Play Store or Amazon App store, you can skip the apk install via App Manager

 

- For App Manager, set the Action to Install, and then APK Path Name to the path where you have placed the apk on the devices file system.

 

- For UI Manager:

  • Change Set default input method? to Change Current input Method
  • Change Select a default input Method Option to User defined Input Method
  • Set Package name of input Method to the Package name of the new keyboard i.e. com.example.android.softkeyboard
  • Set Class name of input Method to the Class name of the new keyboard i.e. com.example.android.softkeyboard.SoftKeyboard

 

UIManager.png

 

In the example project for this Tip, I used a keyboard built by compiling a SoftKeyboard sample project provided by Google. This made the process of finding Package name and Class name a cinch.  Finding these values for a keyboard you installed from the Play store, Amazon or a sideloaded APK may be a chore all on its own.  Once you have the keyboard installed, finding the package name can be done via ADB using the command "adb shell pm list packages -f", but finding the Class Name may be much harder.  My suggestion would be to try to contact the developer or company that created the keyboard and ask for this info. There are other methods that involve deconstructing an APK, but I will not cover that here.

 

Now all you need to do is copy your apk to your device's file system ( if you did not install from the Play Store or Amazon ) and have your app submit KeyboardProfile-1 for processing. If all went well, your new keyboard should pop up when you select a text entry field.

 

Download the Example project for this Tip

profile

Anonymous (not verified)

Please Register or Login to post a reply

Replies