AIR 2.6 Capabilities.screenDPI on Devices
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.
Device | Capabilities.screenDPI | Capabilities.serverString’s &DP | Actual PPI |
---|---|---|---|
Android Nexus 1 (OS 2.3.3) | 254 | 254 | 254 |
Droid Incredible | 254 | 254 | 254 |
Droid X (OS 2.2.1) | 221 (old 240) | 221 (old 144) | 228 |
Droid 2 (OS 2.2) | 221 (old 240) | 144 | 265 |
Samsung Galaxy Tab (OS 2.2) | 168 (old 240) | 168 | 168 |
iPhone 3GS | 163 | 72 | 163 |
iPad | 132 | 72 | 132 |
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>
<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>
Pingback: @renaun posts: AIR Capabilities.screenDPI on Devices