How to get the device UUID in ionic framework How to get the device UUID in ionic framework angularjs angularjs

How to get the device UUID in ionic framework


Yes, there is another way. You just don't need the ngCordova for this.

When you add the plugin cordova plugin add org.apache.cordova.device it's loaded to your application and therefore the info you want is at window.device.

If you want to get device uuid at anywhere in the code you just need to call window.device.uuid.

If you want as soon as the app starts, then use:

ionic.Platform.ready(function(){  console.log( window.device.uuid );});


If you are using '> ionic serve', device will be "not defined." Try in an emulator or physical device.


Use ngCordova and cordova Device plugin:

cordova plugin add org.apache.cordova.device

module.controller('MyCtrl', function($scope, $cordovaDevice) {  var uuid = $cordovaDevice.getUUID();});