如何检测用户的键盘是否为Swype? [英] How to detect if user's keyboard is Swype?

查看:79
本文介绍了如何检测用户的键盘是否为Swype?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以知道用户使用的键盘?如何检查用户是否正在使用Swype键盘?

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

推荐答案

您可以使用以下方法检索当前的默认键盘:

You can retrieve the current default keyboard using:

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

对于各种键盘,您将得到类似com.touchtype.swiftkey/com.touchtype.KeyboardService的结果.第一部分是键盘的主程序包名称,第二部分是它使用的键盘服务的名称.只需解析此String即可查看它是否与Swype的信息匹配(我现在只能提供SwiftKey的详细信息,因为我没有安装Swype).

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).

这篇关于如何检测用户的键盘是否为Swype?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆