Python Get Android Phone Screen Size Using ADB – ADB Tutorial

By | October 13, 2020

In this tutorial, we will introduce adb beginners how to get android phone screen size, which is very helpful to when you are control phone.

We will use python to call adb command to get android phone screen size.

Here is an example:

import subprocess
import os
import re

def get_screen_size():
    process = os.popen('adb shell wm size')
    output =
    m ='(\d+)x(\d+)', output)
    if m:
        return int(, int(
    return None

size = get_screen_size()

Run this code, you may get the size:

(1080, 1920)

1080 is the width and 1920 is the height.

They are physical size of android phone.

Physical size: 1080x1920
Category: ADB

Leave a Reply

Your email address will not be published. Required fields are marked *