简体   繁体   中英

Get real physical size of screen of mobile devices Android or iOS?

I understand DPI/PPI and pixels won't really give the real physical size of the screen, and only info like Extended Display Identification Data (EDID) could give real physical size of the screen. I suspect the smart phones or tablets have such info embedded somewhere. If so, do the operating system like Android or iOS could access such info, thus the APIs could reveal the size in inch or CM?

And then how to get the size through Xamarin C# or JAVA or Swift?

My application is to display a shape in exact physical size on mobile/tablet screens, for example, a ruler.

To get iOS screen size call this method

var screenSize=UIScreen.MainScreen.Bounds;

For android devices use below code

var metrics = Resources.DisplayMetrics;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM