I have a simple Phonegap Build application where I am trying to use the device plugin. I have installed the plugin via command line and have confirmed that it is installed.
I have the following js inside onDeviceReady:
alert(device.platform);
and alert(device.model);
I get white screen with no alerts.
Chrome dev tools remote inspect console says: Uncaught ReferenceError: platform is not defined
The plugin is not being recognized.
Add this cordova pluign using this commend :
cordova plugin add cordova-plugin-device
Try this
<html>
<head>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript">
//add event listener
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
console.log(device); // device object
console.log(device.name); // Gives the name of device.
console.log(device.uuid ); // Gives the UUID.
}
</script>
</head>
<body>
</body>
</html>