Can you get the width and height in inches? If so that would be enough. But even so I think getDpi should work. Maybe even renamed Ppi if that was the original intension. I see a few topics about this but it always seems to get forgotten about.
But I don’t think they realize also that it’s not accurate for android
@ericb365, I checked the getDPI interface, and it returns correct on different devices.
DPI means Dots per inch, PPI means Pixels per inch.
Currently, Device::getDPI is returning correct result.
Do you wanna a new API for getting PPI ?
Okay nice this works! It’s a little bit off but good enough for what I need it for. So with @dumganhar code, a Samsung galaxy s7 returns 576.6554669457003 ppi and a nexus 4 returns ppi of 319.0206090553892.
The s7 is suppose to be 577 but we can round that.
The nexus 4 is suppose to be 318 but it’s not a huge deal.