Simple plugin that returns the device display metrics: dpi, etc.
Create a new Cordova Project
$ cordova create hello com.example.helloapp Hello
Install the plugin
$ cd hello
$ cordova plugin add com.groupe-sii.device-display-metrics
Call the APIs in your project
var success = function(metrics) {
console.log(metrics);
}
var failure = function() {
alert('Error calling DeviceDisplayMetrics Plugin');
}
document.addEventListener('deviceready', onDeviceReady);
function onDeviceReady() {
deviceMetrics.getDpi('', success, failure);
}
Install iOS and/or Android platform
cordova platform add ios
cordova platform add android
Run the code
cordova run
For more information on setting up Cordova see the documentation
For more info on plugins see the Plugin Development Guide