How to detect if user's keyboard is Swype?

2019-04-28 16:44发布

Is it possible to know the keyboard being used by the user? How do I check if the user is using a Swype keyboard?

2条回答
戒情不戒烟
2楼-- · 2019-04-28 17:05

Looks like your answer is here:

How to determine the current IME in Android?

Sometimes it's just about knowing the right search term.

查看更多
forever°为你锁心
3楼-- · 2019-04-28 17:14

You can retrieve the current default keyboard using:

String currentKeyboard =  Settings.Secure.getString(getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);

You will get a result like com.touchtype.swiftkey/com.touchtype.KeyboardService for various keyboards. The first part is the main package name of the keyboard, and the second is the name of the Keyboard Service it uses. Simply parse this String to see if it matches the info for Swype (I can only provide SwiftKey's details right now, as I don't have Swype installed).

查看更多
登录 后发表回答