Programmatically find how many fingers in multitouch Android device supports

拜拜、爱过 提交于 2019-12-21 09:10:31

问题


On Android, it is possible to check programmatically if the device supports multitouch or not wth http://developer.android.com/reference/android/content/pm/PackageManager.html#FEATURE_TOUCHSCREEN_MULTITOUCH.

Is it also possible to check exactly how many fingers the device can recognize in multitouch? E.g. from what I know, a 2-finger multitouch is supported starting with 2.x, but 3-finger multitouch from 4.0. But our customer reports having some new devices with 4.x which still don't support 3 fingers, which makes a simple check against the version of Android OS useless.

A possible solution would be to store in some dictionary for each device which number of fingers it supports max, but with 1k+ devices out there and new ones constantly appearing it's not viable.

Any solution?

EDIT: In fact I just found that the issue reported by the customer was a device issue on HTC One series. See http://www.mobiflip.de/htc-one-serie-multitouch-beschraenkung-aufheben-tipp/ The user has to turn the device-specific gestures recognition in settings to get 5+ fingers working. So, the device would probably even show 5+ fingers support. I guess we will just check for the device's model and show special popup for it telling the user to turn that HTC-specific setting off.


回答1:


As far as I know, there is no way of obtaining the exact number of pointers supported by a device. I don't want to reinvent the wheel here, so I'd like to share a similar problem and a great answer here: Android multitouch in supported devices.

To summarize, notable is the method PackageManager.hasSystemFeature() which allows you to find out in which multitouch-support category does current device belong. Useful feature codes include:

  • FEATURE_TOUCHSCREEN_MULTITOUCH - basic support for 2 pointers
  • FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT - support for 2+ independent pointers.
  • FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND - support for 5+ independent pointers.



回答2:


Instead of checking just for MULTITOUCH, you want to check for FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND



来源:https://stackoverflow.com/questions/14322480/programmatically-find-how-many-fingers-in-multitouch-android-device-supports

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!