I was also looking for a way to do this. So far the only thing I could come up with is to check for common tablet resolutions (800X600 , 1024X768, etc)and flag it as tablet device if the screen resolution is equal to any of them.
To get the physical screen dimension, regardless if dynamic scaling is in use, you can use this code:
local width = display.contentWidth - display.screenOriginX\*2;
local height = display.contentHeight - display.screenOriginY\*2;
local realWidth = m.round(width / display.contentScaleX);
local realHeight = m.round(height / display.contentScaleY);
then you can check for common tablet screen resolutions:
local isTablet = false
if (realWidth == 800 and realHeight == 600) or (realWidth == 600 and realHeight == 800) or (realWidth == 1024 and realHeight == 768) or (realWidth == 768 and realHeight == 1024) then
isTablet = true;
end
[import]uid: 33608 topic_id: 20932 reply_id: 82619[/import]