How to know if a device is a large one (physically)

I try to do something different if the device is a large one (like a iPad or Galaxy Tab) V.S. a small one like a mobile phone.

I am thinking to decide if a device is a large one by following code

local largeDevice = false local model = system.getInfo("model") if (string.find(model, "Pad") ~= nil) then -- it's iPad family     largeDevice = true else     local androidWidth = system.getInfo("androidDisplayWidthInInches")     if (androidWidth ~= nil and androidWidth \> 4) then  -- device over 4 inches          largeDevice = true     end end

Any suggestion? 

Thanks.

You can check the display.pixelHeight and display.pixelWidth to identify large screens. As far as large devices are concerned, I don’t know if there are any identifiers for actual in-hand size.

pixelHeight & pixelWidth? Are they related to physical size?

No, they are related to screen size. It’s conceivable that you could assume a device is large if the pixelHeight/Width are large, but my Nexus 4 has a large pixelHeight but is significantly smaller than a Galaxy Tab, which has a smaller pixelHeight value. So you could assume, but it isn’t gospel.

Rob suggested this formula:

if ( system.getInfo( "androidDisplayWidthInInches" ) \> 5 or system.getInfo( "androidDisplayHeightInInches" ) \> 5 ) then --is a tablet print( "Is tablet" ) else print( "Is phone" ) end  

Not sure if this is a widely used convention, e.g. how does Google (admob) classifies devices (as Corona uses smartbanners, they are 50px high for phone and 90px for tablets).

I would give >6 because 5 is too close to current smart phones and some roundings would give you tablet instead smartphone

You can check the display.pixelHeight and display.pixelWidth to identify large screens. As far as large devices are concerned, I don’t know if there are any identifiers for actual in-hand size.

pixelHeight & pixelWidth? Are they related to physical size?

No, they are related to screen size. It’s conceivable that you could assume a device is large if the pixelHeight/Width are large, but my Nexus 4 has a large pixelHeight but is significantly smaller than a Galaxy Tab, which has a smaller pixelHeight value. So you could assume, but it isn’t gospel.

Rob suggested this formula:

if ( system.getInfo( "androidDisplayWidthInInches" ) \> 5 or system.getInfo( "androidDisplayHeightInInches" ) \> 5 ) then --is a tablet print( "Is tablet" ) else print( "Is phone" ) end  

Not sure if this is a widely used convention, e.g. how does Google (admob) classifies devices (as Corona uses smartbanners, they are 50px high for phone and 90px for tablets).

I would give >6 because 5 is too close to current smart phones and some roundings would give you tablet instead smartphone