get device uuid ionic ios app


In my app i want to get the device uuid or udid so that i can save it in my database.

for my android app when i run this code in my js file

.factory('Service', function($state) {
  var service = {
    login: function(user, new_device_status) {
      if(window.cordova) {
        var params = {
          organization: user.orgCode.$modelValue,
          password: user.password.$modelValue,
          device_uuid: window.device.platform == 'Android' ? window.device.uuid : window.device.udid,
          new_device: new_device_status

it works and returns the uuid of the device but in my ios app when i try this it doesnt work or when i try


it still doesnt work in my ios simulator. what can i do?


Solution 1 :

Add device plugin :

cordova plugin add org.apache.cordova.device

In your controller :

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

Answer from : How to get the device UUID in ionic framework

Solution 2 :

Use IDFVPlugin :

cordova plugin add

In your controller :


Sources :

I hope it will help you.

Answered By – Grégoire Motot

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published