• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
1

Getting Accurate iPhone Screen Resolutions

Explorer ,
Nov 01, 2017 Nov 01, 2017

Copy link to clipboard

Copied

Does anyone know why getting any of the following returns a screen of 640x1136 on an iPhone 6/7/8 Plus?

stage.screenWidth/Height

stage.width/height

Capabilities.screenResoltuionX/Y

Screen.mainScreen.bounds

The actual resolution of one of these phones is 1242x2208 or 1920x1080 depending on how you measure it.

Using:

stage.scaleMode = StageScaleMode.NO_SCALE;

stage.align = StageAlign.TOP_LEFT;

And the values don't change after a resize event, not even many resize events.

In 2017 with AIR 27 is there still no way to get an accurate read on the screen size?

TOPICS
Development

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Nov 01, 2017 Nov 01, 2017

You may also want to make sure you're bundling launch images for that specific device size when you're creating the IPA file -- if the app doesn't contain a launch image with a specific name and resolution, iOS will use a lower resolution and just scale up the content itself. 

I believe the one you need to include is "Default-414w-736h@3x~iphone.png" for it to recognize it should use the full resolution on a 6/7/8 Plus, otherwise it'll go with the the lower resolution like you mentioned, and rep

...

Votes

Translate

Translate
LEGEND ,
Nov 01, 2017 Nov 01, 2017

Copy link to clipboard

Copied

Happy to see you posting AIR questions!

There is an initial resize event that you ought to be able to trust. All my apps were made in Flash Pro, and I just used the normal stage scale modes, so generally I don't have any problems. There are exceptions, like Kindle for example, where the button bar comes and goes in a way that is hard to deal with. I just place things in a way that can cope with that unpredictability.

The way I work with stage scale modes, and for example getting a button to hug the edge of the screen, is with this logic:

use the capabilities to figure out the ratio of the device

If I'm using showAll I know that my landscape app will have the stage filling the width of the device

I know the Y position of the button on my original stage (say 1024x768)

I move the button to real width/1024 * originalY*real height

I didn't double check my memory, but even if what I wrote as wrong, you're a mathematician, you should be able to see what I'm getting at.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 01, 2017 Nov 01, 2017

Copy link to clipboard

Copied

I went back and checked my memory. Here's some timeline code to make a button hug the left of the screen, for an original stage size of 1024x768. 'goleft' is the instant's name:

var realheight = Math.min(Capabilities.screenResolutionX, Capabilities.screenResolutionY)

var realwidth = Math.max(Capabilities.screenResolutionX, Capabilities.screenResolutionY)

var vr = realwidth / realheight;

var ew = 768 * vr;

var gap = Math.floor((ew - 1024) / 2);

goleft.x = 1 - gap;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 01, 2017 Nov 01, 2017

Copy link to clipboard

Copied

You may also want to make sure you're bundling launch images for that specific device size when you're creating the IPA file -- if the app doesn't contain a launch image with a specific name and resolution, iOS will use a lower resolution and just scale up the content itself. 

I believe the one you need to include is "Default-414w-736h@3x~iphone.png" for it to recognize it should use the full resolution on a 6/7/8 Plus, otherwise it'll go with the the lower resolution like you mentioned, and report that lower value for screenWidth / Capabilities.screenResolutionX, etc.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 01, 2017 Nov 01, 2017

Copy link to clipboard

Copied

Thanks Colin and Flipline! Colin -- I already use those methods for placements, but sometimes you need to have the real screen numbers. Examples: Ad placements in ANEs, CameraUI CameraRollBrowseOptions placements, and of course the identification of specific phone models in order to enable/disable features and such.

Flipline - it worked and I now get correct results. Plus, I now found this page, which gives me a list of launch images to include:

http://blogs.adobe.com/airodynamics/2015/03/09/launch-images-on-ios-with-adobe-air/

The problem now is to worry about future launch images. For instance, what size image and specific name will I need for the launch image of the iPhone X? It is critical I find out in the next week or two. I'll have my hands on one on Friday, but that may not help if I can't figure out what to name the launch image. Default-375w-812h@3x~iphone.png is one guess. But if that is wrong...?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 03, 2017 Nov 03, 2017

Copy link to clipboard

Copied

For those interested, I can now report the values the iPhone X returns.

Before a couple of Event.RESIZE events, the stage.stageWidth and stage,stageHeight return 1920,3408

After those initial Event.RESIZE events, they return 1125,2436

Capabilities.screenResolutionX/Y returns 1125,2436 from the very start.

It took an included default image named Default-375w-812h@3x.png to trigger the app to use the full resolution. Otherwise, and with older apps, it just appears in a box centered on the screen. This is actually great, as if you have ads at the top, they won't be blocked by the "notch" and violate AdMob's TOS. So now I can take my time to update my apps for the iPhone X instead of rushing it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 03, 2017 Nov 03, 2017

Copy link to clipboard

Copied

The whole real pixel and pseudo pixel thing is complicated. Thanks for confirming the file name, I think ~iphone would work too, and I would be tempted to add it even if it's not needed!

One thing to read into is the safe area of iPhone X, and also the recommendation to not hide the status bar.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

Gary could you please expand on what you did to get the full screen resolution on the iPhone X as I am having problems with this.

I have included two additional launch images, Default-375w@3x.png and Default-812h@3x.png which are 2436x1125 and 1125x2436 respectively.  I'm fairly certain that these launch images are not being picked up for some reason though (I have checked they are added to the project in the publish settings deployment section).

I have set full screen to false but have tried true as well.

Is there something else I should be looking at?

I am publishing direct to a real iPhone X.

Thanks for your help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 08, 2017 Nov 08, 2017

Copy link to clipboard

Copied

LATEST

Following my last post I have now solved the problem which was to use a single file with the full name you had used i.e. Default-375w-812h@3x.png.

As per my previous post I had used two operate files, one for portrait and one for landscape as had been the usual format for older versions and that has worked fine.  Thanks for your previous post which did have the right answer I just didn't recognise clearly enough.  Anyway I hope this clarification will help others.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines