Edit: wall of text sorry.
Correction: Android devices are indeed required to have a touch screen per CDD
Update: finished reading the 2.2 CDD. Section 8.5 Touchscreen input: “SHOULD support fully independently tracked points, if the touchscreen supports multiple pointers.”. So i gather it’s not a MUST. Oh well…
So, for nearly a year now i’ve been very disappointed with how multi-touch works on Android. Or rather does not work on most devices. This is nothing we can blame on Google. Some hardware manufacturers (HTC, Motorola to name the most prominent ones) don’t like bundling proper multi-touch screens with your 500$ phones. Why? I have no freaking idea, i imagine the cost of a proper touch pad wouldn’t be that much higher and i’d even be willing to throw out a few extra bugs to have proper multi-touch.
There’s two types of multi-touch functionality on Android. Let’s call them gesture multi-touch and real multi-touch. Gesture multi-touch is the only thing available on phones like the Nexus One. It features a “self capacitive” touch pad suited for gestures like pinch zoom but not suited for keeping track of multiple finger positions. Check the link to find out more. Real multi-touch on the other hand allows both, gesture detection as well as keeping track of multiple individual fingers.
Now, i could live with that fact if only there was a way for me as a programmer to know what’s actually supported by the phone my app is running on. Last time i checked (and i checked long and hard) there was no such thing. That was when API version 6 came out.
I wanted to implement multi-touch support for libgdx today and checked again. And, oh my fsm, i found something in the PackageManager class. Namely the following constants to be used with PackageManager.hasSystemFeature():
- PackageManager.FEATURE_TOUCHSCREEN, The device’s display has a touch screen.
- PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH, The device’s touch screen supports multitouch sufficient for basic two-finger gesture detection.
- PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT, The device’s touch screen is capable of tracking two or more fingers fully independently.
For games we want PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT for obvious reasons. The N1 will return false. I have to test with the Motorola Droid, but it should also return false. Its screen is also severly broken.
Seeing this i was happy at first. Then i realized that PackageManager.FEATURE_TOUCHSCREEN is actually pretty scary. There will be Android devices without a touch screen? I thought that was a minimum requirement? Maybe the documentation is just not extensive enough though and it serves as a valid but ultimately useless counterpart to PackageManager.FEATURE_TOUCHSCREEN_MULTITOUCH. If that’s not the case than i’m really afraid of the future. I assume that all the game UIs out there are touch driven, those would brake immediatly. Of course you could check at startup whether the device has a touchscreen at all. But…
Those 3 constants are API Level 7 and 8, that is 2.1 and 2.2. Now, a lot of devices have received an update to 2.1 already, even my trusty HTC Hero. But i’d assume that only very low-budget devices would not have a touch screen. I’d further assume that those wouldn’t sport 2.1 or 2.2 either than. As a developer i’d have no chance of detecting the missing touch screen then.
Why those constants weren’t there from at least 2.0 onwards is a riddle to me. Better late than never though, at least things are moving forward.
In order to access the market with a new device each manufacturer has to pass the Android compatibility program. This program is executed by Google itself which sets the minimum software and hardware requirements a device has to fulfill for a specific version in order to be allowed to access the market. Additionally the software and hardware stack have to pass the compatibility test suite as a final test. Real multi-touch support from day 1 would have been the bestest thing since sliced bread for Android in my opinion. I can live with a software renderer for OpenGL, even one that does only affine texture mapping. But having this mess of multi-touch support is just sad.
I still love Android and think Google is doing a fine job! It’s everyone’s fault!