AIR 2.6 Capabilities.screenDPI on Devices

Posted on March 3, 2011 | 1 comment

I had previously posted on the subtleties of screen PPI on devices here. Since then the AIR runtime is making changes to help where the OS provides the wrong PPI. Its not perfect but its a work in progress, which means if you have devices and wrong PPI’s please let us know.

DeviceCapabilities.screenDPICapabilities.serverString’s
&DP
Actual PPI
Android Nexus 1
(OS 2.3.3)
254254254
Droid Incredible254254254
Droid X
(OS 2.2.1)
221 (old 240)221 (old 144)228
Droid 2
(OS 2.2)
221 (old 240)144265
Samsung Galaxy Tab
(OS 2.2)
168 (old 240)168168
iPhone 3GS16372163
iPad13272132

NOTE: For iOS devices the latest Packager for iPhone is not available so they have not been updated. The rest use the latest AIR 2.6 release.

Here is the Flex blank mobile application code that I am using to test for the values:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               applicationComplete="getDPI()"
               width="100%" height="100%">
    <s:layout>
        <s:VerticalLayout />
    </s:layout>
    <fx:Script>
        <![CDATA[
            protected function getDPI():void
            {
                lblDPI.text = "screenDPI = " + Capabilities.screenDPI;
                var value:String = unescape(Capabilities.serverString);
                lblServerStringDP.text = "serverStringDP = " + value.split("&DP=", 2)[1];
            }
        ]]>
    </fx:Script>
    <s:Label id="lblDPI" width="100%" />
    <s:Label id="lblServerStringDP" width="100%" />
</s:Application>