In phonegap, if we want to know the device information then we have to add a plugin for the same and from that we will have a device object which describe the hardware and software of the device.
The properties include:
device.name
device.version
device.cordova
device.uuid
device.model
device.version
This is how we can get the values as the device is assigned to the window object so it is in the global scope.
var phoneModel = window.device.model;
This is how to can have the information of all the above things in a variable.
Now, adding plugin for device:
$ cordova plugin add org.apache.cordova.device
$ cordova plugin ls
From this we can get the required information by just placing the code inside.
document.addEventListener("deviceready", onDeviceReady, false);
Hope this will help you in getting device information.
0 Comment(s)