Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I've got adb access to my android phone.

So I know that I can override screen density and screen resolution with the am command provided with Android. That's great and dandy, I guess. But is there a way to grab those two numbers from the command line? I know the pm utility can do some information gathering, most notably pm list features to see if the Android device has wireless, bluetooth, gps, etc. pm doesn't seem to do much more information reporting than this, though.

It would be helpful to know what versions of Android that the command is supported for. Ideally I would like something that works on Android 2.2+ (Froyo), but taking something that only works from 4.0.3+ (Ice Cream Sandwich) is fine too. I would also like it if there was a way to figure this out without root access.

I know that it's possible to get the screen resolution and density programmatically, as described in this question.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

the result and precise format of the dumpsys command depends on the hardware vendor (of graphics chipset/driver and handset itself) but you should be able to find that info in the adb shell dumpsys display output

share|improve this answer
    
So I could call adb shell dumpsys display | grep mBaseDisplayInfo to get the appropriate information? It seems to match up, on my nexus 7 dumpsys reports the density to be 213 and the resolution to be 800x1280. It also reports information on rotation and such, neat. I didn't know dumpsys existed, but it seems to report on a lot of useful information as noted here: stackoverflow.com/questions/11201659/… –  Ehtesh Choudhury Apr 26 '13 at 20:14
    
yes. the problem is that different phones could have a different format of this line –  Alex P. Apr 26 '13 at 20:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.