I use PhoneGap in Devextreme. I try Get UUID. But it isn't working and get an error. How do I use it? Why do I get an error?
error
"onDeviceReady isn't defined"
Add following to config.xml:
<plugin name="cordova-plugin-uniquedeviceid" source="npm" />
Add following to index.js:
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
try {
var uuid = device.uuid;
alert(uuid);
} catch (e) {
alert(e);
}
}
I saw that you are using cordova-plugin-uniquedeviceid
package to get uuid.
This is how cordova-plugin-uniquedeviceid
library documentation tells to get device uuid.
// Get UUID
function onDeviceReady() {
window.plugins.uniqueDeviceID.get(success, fail);
}
function success(uuid){
console.log(uuid);
};
document.addEventListener("deviceready", onDeviceReady, false);