Screen size and density
Reads pixel size, density and scale factor with no prompt.
In one line
Can see your screen size, sharpness and scale, with no prompt
Reads pixel size, density and scale factor with no prompt.
Identifies the device model almost uniquely on iPhone and narrows it on Android. Needed for layout; also a long-lived fingerprint field.
What it can and can't do
What the user does: Nothing. The app checks when it opens, to lay out its screens
It can
- See screen width and height, in pixels on Android and points on iPhone
- See sharpness, 120 to 640 dpi on Android and scale 2 or 3 on iPhone
- Fit its layout to your screen
- See window size on newer Android
It cannot
- Learn who you are from screen size alone
- See what is on screen in other apps
- Change the screen resolution
On Android and iPhone
| Android | iPhone | |
|---|---|---|
| Status | Supported | Supported |
| First version | Android 1.0 (API 1) | iOS 2.0 |
| Permission or entitlement | Not listed | none |
| Protection level | none | none |
| How access is granted | none | none |
| What the user sees | Not listed | Not listed |
| How long it lasts | Not listed | Not listed |
| How to take it back | Not listed | Not listed |
| Store policy | None listed | None listed |
| API | DisplayMetrics (widthPixels, heightPixels, density, densityDpi), WindowMetrics (API 30) | Scale 2.0 or 3.0 on iPhone; bounds in points |
| Notes | Density 120 to 640 dpi; size in px | None |
Data you get
What comes back: Width, height, density
Shape: object
How often: On change (rotation, fold)
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
width_px | integer | px | 320 to 3840 | 1 px |
density | float | ratio | 0.75 to 4.0 | 0.25 steps |
Technical limits
- Multi-window and foldables report window, not screen, size
The story
What it is
An app can read the size of your screen and how sharp it is.
For you
You never see it. It is needed to draw the app properly. It also tells an app almost exactly which phone you have.
For makers
Makers need it to lay out screens for every size. Because the numbers are so specific, they also work as a long lasting fingerprint detail.
Where you see it
| Type | Example | Apps |
|---|---|---|
| games | A game scales its menus and touch buttons to fit your exact screen. | None named |
| shopping | A store app shows a grid with two or three product columns depending on your width. | None named |
| creative | A drawing app sizes its canvas to the screen sharpness. | None named |
| media | A video app picks a video size that fits your screen and saves data. | None named |
| ads | An ad network picks an ad size and joins it with other details to guess your phone. | None named |
| accessibility | A reading app lets you pick larger text based on your screen density. | None named |
Risks
- Narrows down your phone model
- Long lived fingerprint detail
Android and iPhone in short
- Android: Reads pixel size, density and scale factor with no prompt.
- iPhone: Reads size and scale, which pins down the iPhone model.
Good uses and abuse
Legitimate uses
- Layout
Known abuse
- Fingerprint
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 1 of 5 | How revealing the data is |
| Utility | 3 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | 5 | Rough identifying entropy, when known |
History
- 2020-09, Android 11 (API 30): WindowMetrics added for multi-window
- 2020-09, iPhone iOS 13: Per-scene screens (UIWindowScene) replace main-screen use
Related capabilities
Related
- Display refresh rate and HDR. Can see your screen refresh rate and whether it shows HDR, with no prompt
- Device model and manufacturer. Can see your exact phone model and maker on Android, and a model code on iPhone
Same idea on the web
- Screen width and height. Can see your screen width and height, and the usable area, in page units
- Device pixel ratio and zoom. Can see your screen's sharpness factor, which also shifts when you zoom
Sources
- Android: Display
- Apple: UIScreen
- Kurtz et al.: Fingerprinting Mobile Devices Using Personalized Configurations (PoPETs 2016)
How well checked: Inferred from related behavior.