1

How do I query for the features that an Android touchscreen supports? In particular, I want to know whether yet-to-be-received input on the screen will emit values for pressure, major axis width, and minor axis width.

I'm not doing this to limit my app to installation on specific devices, but instead to test my software, which detects specialized gestures. I know that I can determine whether the device has emitted axes or pressure upon receiving input, but I'm generated log files in advance of testing that need to report expectations during the test (to simplify things a bit).

The answer to this question appears to involve the InputDevice class, but I don't see how to use this class to get the information.

(Note: I found a related question, but mine is more general: determining the features supported by the device's screen. People might also dismiss that question because the determination can be made after receiving input.)

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Joe Lapp
  • 2,435
  • 3
  • 30
  • 42
  • All the Android devices I am currently aware of (since 2008) are **capacitive**. They work by sensing *proximity*, not *pressure*. – Phantômaxx Jan 30 '19 at 17:35
  • Thanks @Fantômas. That may be the case -- I haven't yet used one supporting pressure -- but the [API itself](https://developer.android.com/reference/android/view/MotionEvent.html#getPressure(int)) claims to support pressure. In any case, my solution is not dependent on the existence of pressure, but gives added advantages when it is there. So I still would like to detect it, in case such devices do exist. – Joe Lapp Jan 30 '19 at 17:40
  • I'm also seeing devices that do not support distinct major and minor axes, and other devices that do. So that's another feature I'd like to detect prior to input. – Joe Lapp Jan 30 '19 at 17:42
  • You may try to get the pressure and eventually handle the error – Phantômaxx Jan 30 '19 at 17:43
  • It's too late by then. I'm laying ground work in the log header, and I don't want the added complexity of generating the log header only after the first input is received -- all for not knowing how to get device characteristics. And I'd need a non-trivial sampling to conclude that major and minor axes are not independent. (FYI, no error is reported -- I just get pressure == 0.) – Joe Lapp Jan 30 '19 at 17:46
  • 1
    So, when the pressure is 0, nothing happens. If it's between 0 and 1 you can handle the returned value. – Phantômaxx Jan 30 '19 at 17:48

0 Answers0