How to work out the physical Screen Size?

Hi All

I’ve just started work on porting my Android game to Apple and have run into an issue with detecting the devices physical screen size. After searching the docs and forums for hours I can’t find a solution.

For Android I used this code.

\_GData.smallScreen = false local aDpi = system.getInfo("androidDisplayApproximateDpi") local wII, hII if aDpi then wII = display.pixelWidth / aDpi hII = display.pixelHeight / aDpi if (wII\*hII) \< 17 then \_GData.smallScreen = true end end

I really need to know if the screen is physically big or small because some of the puzzles in my game are impossible to play on small phone screens. Maybe there is another solution like detecting the type of device?

I’m sure I’m going to be asking more questions as this is my first time using any type of Apple device.

Your help would be greatly appreciated.

If you wanted to be super-specific you could do it by device, since there are comparatively far fewer Apple devices than there are Android devices.

https://docs.coronalabs.com/api/library/system/getInfo.html#architectureinfo

Thanks Alex

After doing a search of screen sizes for the iphone I came across this https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions

It looks like I only have to check to see if the model is less than 6 to know it’s a small screen (physically).

I thought about using string sub to get the number but the architectureinfo docs say iOS will return values such as iPhone6,1 or iPad5,3

If I worked from the end first I could check to see if more than one number exists and take the second one as the model number. (Thinking out loud)

If you wanted to be super-specific you could do it by device, since there are comparatively far fewer Apple devices than there are Android devices.

https://docs.coronalabs.com/api/library/system/getInfo.html#architectureinfo

Thanks Alex

After doing a search of screen sizes for the iphone I came across this https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions

It looks like I only have to check to see if the model is less than 6 to know it’s a small screen (physically).

I thought about using string sub to get the number but the architectureinfo docs say iOS will return values such as iPhone6,1 or iPad5,3

If I worked from the end first I could check to see if more than one number exists and take the second one as the model number. (Thinking out loud)