Rob Rob - 1 year ago 344
Bash Question

How to find out Android device diagonal display width or screen size using adb shell?

I need to find out device-width to keep track the set the different actions based on different width of every device, which is further used to write a script to automate the process. Through my research I get to find out using certain commands like-

$ adb shell wm size
Output-Physical size: 720x1280

adb shell wm density
Output-Physical density: 320

Curious to know, if there is any other better way of doing this?


You can write the following function to get the diagonal display size in inch using the information you have-

def find_display_size(d):
x = math.pow(wi,2);
y = math.pow(hi,2);
screenInches = math.sqrt(x+y);

That is the best possible way I can think of and open to know the more correct way, if anybody has.

Also you can refer this-

Display Screen Dimension Example

Supporting Multiple Screens