Skip to main content
Herado__
Inspiring
October 17, 2016
Question

AIR 23 Android screen size measurement error

  • October 17, 2016
  • 1 reply
  • 679 views

Compile our Android App with AIR22 and . .  .

This code:

public function getDeviceRectangle():Rectangle{

  var dr:Rectangle = new Rectangle(0, 0,

  Math.max(this.width, this.height),

  Math.min(this.width, this.height));

  return dr;

  }

Gives us  0  0 1024  552  for a Kindle fire which has a 1024 x 600 screen and Status Bar which cannot be removed

This works for us as we then scale the app to fit the available space.

Compile on AIR 23 and the same code returns   0  0   1024  600   which is the full screen ( including the android status bar )

Since many apps will use this code as starting point for scaling up their app to fit the many android resolutions it's important to know whether we're scaling to the available screen ( less the Android UI )

Note - I've also tried <fullscreen>true<fullscreen>  which throws a compile error.

This topic has been closed for replies.

1 reply

Participant
October 18, 2016

What does stage.stageWidth and stage.stageHeight return in your app? I always use those to measure the screen.

Inspiring
November 18, 2016

I have the same problem.

With AIR 22   stage.stageWidth =  2560  stage.stageHeight = 1440 Capabilities.screenDPI = 640

With AIR 23   stage.stageWidth =  2560  stage.stageHeight = 1334 Capabilities.screenDPI = 640

If I press the HOME key to jump out and then back to APP, It will return to normal.

stage.stageWidth =  2560  stage.stageHeight = 1440 Capabilities.screenDPI = 640

My app.xml

  <initialWindow>

    <title>MJ16TW</title>

    <content>MJ16TW.swf</content>

    <visible>true</visible>

    <fullScreen>true</fullScreen>

    <autoOrients>true</autoOrients>

    <renderMode>gpu</renderMode>

    <systemChrome>standard</systemChrome>

    <transparent>false</transparent>

    <aspectRatio>landscape</aspectRatio>

  </initialWindow>

Smart Phone

Please help me.

Thank you.