AIR Capabilities.screenDPI on Devices
NOTE: Some of the values have changed in AIR 2.6 see the latest post here.
The relationship between the screen resolution and physical size of the device is very important to know when building multi-screen applications. The AIR and Flash Player runtimes provide information about the hardware capabilities through a set of APIs. The sad news is the current state of this information is somewhat dependent on the OS providing correct information, or at least it is not consistent across devices. I have confirmed that even with native Java applications on Android the screen DPI (or PPI) is not correctly provided. This seems to be a bug starting at the different OS implementations, but I wanted to give a current snapshot of the situation and gather more information. The data below will show the inconsistencies and hopefully enough information to still make decent decisions about physical screen size.
I am going to provide real world data from devices and am looking for more people to provide device information comparing two specific values from the
Capabilities class. What I have done is compared the
DP value across a half dozen devices that I have.
|Device||Capabilities.screenDPI||Capabilities.serverString’s &DP||Actual PPI|
|Android Nexus 1||254||254||254|
|Samsung Galaxy Tab||240||168||168|
NOTE: For iOS devices the latest Packager for iPhone available on labs.adobe.com was used. The rest use the latest AIR 2.5 release.
From the data above the only devices where it will be hard to get any valuable information from is the Droid 2 and X devices. For some reason they both provide 240 and 144 values but are clearly different actual PPI’s on those two devices.
If you have other devices not in my list with AIR installed on the device and you please post the values for
Capabilities.serverString in the comments.