Display area confusion

Hi, I’m a bit confused about how to deal with the scale factor of the display.

For example, on a tablet i might get a display of 2560x1440 and scale 1 which is all straight forward. However, on a phone I might get the following for the same resolution: 647x364, scale 3.73. What decides that this should be 647x364 (which appears to be my resolution for accessing the screen logically) instead of 1280x770 with a scale factor of 2 (for example)?


It’s a bit different for every OS. On macOS/iOS we get the scale factor from NSScreen/UIScreen. In android we use densityDPI and divide this by 150.0.