In my Cordova android app i am using getDeviceId function to get the unique device id.
function getDeviceId(){
var temp;
newid=cordova.require('org.apache.cordova.uuid.UniqueDeviceID');
newid.getDeviceID(success,fail);
function success(uuid){
//this works
alert("inside function"+uuid);
temp=uuid;
}
function fail(err){
// alert("error"+err);
}
return temp;
}
And i am calling this function like this way
var deviceId=getDeviceId();
//undefined error
alert("from function"+deviceId);
I will get device-id successfully inside the function,but the return value will give undefined error.