Can I get the device resolution by code?

I can’t remember if the device’s resolution was available by code or not. I think the size is but is the resolution? I tried searching but no luck.

Thanks,

Warren

If you have your app set to letterbox, this function - http://docs.coronalabs.com/api/library/display/actualContentHeight.html - will return the actual content height including the letterbox area.

I think the following might give you what you need : 

local actualWidth  = display.pixelWidth  local actualHeight = display.pixelHeight 

Some additional useful API calls on Android

local androidDispWidthInInches = system.getInfo( "androidDisplayWidthInInches" ) or 0 local androidDispHeightInInches = system.getInfo( "androidDisplayHeightInInches" ) or 0 local androidDispDiagInInches = 0  androidDispDiagInInches = math.sqrt((androidDispWidthInInches^2) + (androidDispHeightInInches^2)) local androidDispXDpi = system.getInfo( "androidDisplayXDpi" ) or 0 local androidDispYDpi = system.getInfo( "androidDisplayYDpi" ) or 0

If you have your app set to letterbox, this function - http://docs.coronalabs.com/api/library/display/actualContentHeight.html - will return the actual content height including the letterbox area.

I think the following might give you what you need : 

local actualWidth  = display.pixelWidth  local actualHeight = display.pixelHeight 

Some additional useful API calls on Android

local androidDispWidthInInches = system.getInfo( "androidDisplayWidthInInches" ) or 0 local androidDispHeightInInches = system.getInfo( "androidDisplayHeightInInches" ) or 0 local androidDispDiagInInches = 0  androidDispDiagInInches = math.sqrt((androidDispWidthInInches^2) + (androidDispHeightInInches^2)) local androidDispXDpi = system.getInfo( "androidDisplayXDpi" ) or 0 local androidDispYDpi = system.getInfo( "androidDisplayYDpi" ) or 0