Reputation: 173
I'm trying to retrieve the device UUID using phonegap but the whole device information plugin doesn't seem to be working. I'm just using the sample codes from phonegap site's docs in my index. http://docs.phonegap.com/en/1.3.0/phonegap_device_device.md.html
<!DOCTYPE html>
<html>
<head>
<title>Device Properties Example</title>
<script type="text/javascript" charset="utf-8">
// Wait for PhoneGap to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// PhoneGap is ready
//
function onDeviceReady() {
var element = document.getElementById('deviceProperties');
element.innerHTML = 'Device Name: ' + device.name + '<br />' +
'Device PhoneGap: ' + device.phonegap + '<br />' +
'Device Platform: ' + device.platform + '<br />' +
'Device UUID: ' + device.uuid + '<br />' +
'Device Version: ' + device.version + '<br />';
}
</script>
</head>
<body>
<p id="deviceProperties">Loading device properties...</p>
</body>
</html>
I re-installed the device information plugin just to be sure, but Loading device properties...
is all that's displayed on index.html
I'm also experiencing the same issue with cordova-plugin-sim
Phonegap getting sim information using cordova-plugin-sim
But I was able to implement the barcode scanner plugin without much of a problem. Could this issue somehow be linked with why I'm not able to retrieve anything from the cordova sim plugin?
Phonegap version is 6.4.6
Node version is 7.9.0
Cordova version is 6.5.0
Upvotes: 0
Views: 403
Reputation: 2822
Seems you are missing the plugin. Your onDeviceReady function must be working (test it by showing an alert).
You need to install the plugin to access the device object. Try to install the plugin as below:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
Upvotes: 1
Reputation: 938
Where did you reference the cordova.js file in your page???
<script type="text/javascript" charset="utf-8" src="phonegap-1.3.0.js"></script>
did you have a file called phonegap-1.3.0.js in your www folder ?
change the reference to cordova.js and give a try.
Hope it helps you
Upvotes: 1