Get DPI Value - not scale (Identify phone - tablet)

Hello,
How can I get DPI value for identify user’s device (phone less than 6 inch or tablet greater than 6 inch)?

Best regards.

Bump. I’m also looking for a way to differentiate phones from tablets.