AIR Capabilities.screenDPI on Devices

Posted on January 5, 2011 | 8 comments

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 Capabilities.screenDPI and Capabilities.serverString‘s DP value across a half dozen devices that I have.

DeviceCapabilities.screenDPICapabilities.serverString’s &DPActual PPI
Android Nexus 1254254254
Droid Incredible254254254
Droid X240144228
Droid 2240144265
Samsung Galaxy Tab240168168
iPhone 3GS16372163
iPad13272132

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.screenDPI and Capabilities.serverString in the comments.

  • http://savagelook.com/blog Tony Lukasavage

    Very good information to know. I was very excited when all this multiscreen tech came out, especially when I saw the iReverse demos. Seems like there’s a few more hurdles every day though. I’m not saying I’m not going to pursue it, just that it isn’t going to be quite as simple as I once thought.

    • http://www.renaun.com Renaun Erickson

      Yes, with all the hype across all the devices and available tech, be it Flash/AIR or other technologies, there is a bit of real world growing pains. Things will get better as the tech and devices progress but for now its part of the learning curve.

  • http://blog.yoz.sk Jozef Chutka

    based on DPI you can guess screen size, 1 cm in pixels, 1 inch in pixels etc…
    http://blog.yoz.sk/2010/12/quick-tip-systemscreen-class/

    • http://www.renaun.com Renaun Erickson

      The issue is the screenDPI value is not always correct. And what you are seeing in your post is that desktop’s always provide 72 dpi (event though Mac is 72 and Windows is 96). The 72 dpi comes from the old PC and print world. So even though you might have a 1920×1200 resolution on your PC on a 32in monitor or a 24in monitor the Desktop’s always still show 72 dpi, where the actual Pixels Per Inch is quite different from 32in to 24in. On devices the DPI value was suppose to become a valid number to be able to use but seems to have some quirks at the moment.

  • Pingback: Adrian Parr’s Blog » Blog Archive » Test for Capabilities.screenDPI

  • Pingback: AIR Android??????Flash, Flex Hero | 2-38-1:??????????????

  • Pingback: @renaun posts: AIR 2.6 Capabilities.screenDPI on Devices

  • nuthinking

    After 3 years… on Nexus 5 while the real DPI is 445, AIR returns 480.

    • renaun

      The OS doesn’t report it correctly.

      • nuthinking

        Yeah, I read you said is the same in native (Java). Still sucks :)

        • renaun

          Yes still is really dumb all around.

          Usually you have to check the dpi, then the screen resolution X/Y and check if the dpi is close. But in the end you are really only can go for general ranges of dpi’s (phone, tablet, etc)