Skip to main content
Known Participant
January 2, 2014
Question

How to obtain Android screen real width/height in AIR?

  • January 2, 2014
  • 1 reply
  • 3610 views

The system chrome displays some additiona bar with three dots. No matter what I use, AIR always reports the actual height incorrectly - it's not the height of the screen, but the height of available area (so the screen height - system bar height). This turns device detection into a mess. Is there a solution for this?

Tried:

Capabilities.screenResolutionY

stage.height

state.stageHeight

stage.fullScreenHeight

they all return the same value.

Or, is there a way to get rid of that system bar and enter true fullscreen?

This topic has been closed for replies.

1 reply

User Unknow
Legend
January 4, 2014

screebresolutionx/y return full display resolution, not flash rect.

ai use stage.stageWidth and stage.stageHeight for determination of flash content size. and before this dont forget to add stage.scaleMode to noScale

Known Participant
January 4, 2014

Capabilities.screenResolutionY does *NOT* return full display resolution (on Android with system bar) - that's the point. No matter what I do (target different sdks), the bar is always there, influencing the resolution returned by AIR. Stage scaling has nothing to do with this.

Projectitis
Inspiring
November 19, 2015

Sebastian - did you ever solve this?  I have exactly the same issue.

I have an Android device with a screen of 720x1280 (Samsung Galaxy Nexus).

No matter which of these I try, they NEVER return the full width of 1280.  They either return 1184 or 1192 depending on whether the screen is portrait or landscape (the width of the toolbar changes slightly).

Capabilities.screenResolutionY

stage.height

state.stageHeight

stage.fullScreenHeight

Screen.mainScreen.visibleBounds.height

Screen.mainScreen.bounds.height

stage.nativeWindow.height (NB: nativeWindow is null)

NativeApplication.nativeApplication.nativeWindow.height (NB: nativeWindow is null)

There seems to be no way of grabbing the actual, no-toolbar, screen size at all, let alone reliably.