I’ve recently released a very simple plugin for PhoneGap.
It allows access to the screen’s PPI (also called DPI).

Grab it here:
http://plugins.cordova.io/#/package/org.tbyrne.cordova.plugins.screenppi