Header Ads

Deviceid in ionic

Get DeviceId in Ionic

DeviceId is a distinct number associated with a smartphone. DeviceId means Device Identification, every mobile phone has unique device id associated to identify. These device identification unique constant for a lifetime. It changes when factory reset performed on a mobile phone.

deviceid


deviceready() function

deviceready() function ready to get all data from mobile phone. The function calls, when the app is ready for a mobile phone.

document.addEventListener("deviceready", function () {
      //deviceready function
})

UUID

UUID is ordered to make a  connection. UUID is a universally unique identifier standard 28-bit format for a string id used to uniquely identify information.

var demo = device.uuid

platform

Get all data about a mobile phone like device operating system name and version of the operating system.

var demo = device.platform

version

The version will get the operating system version.

var demo = device.version

Cordova device plugin

It will give related information about phone(Device information, Cordova version, unique identifier, model number, platform details)

Installation

cordova plugin add cordova-plugin-device


Step-1

    angular.module('home.ctrl', [])
         .controller('homeCtrl' , ['$cordovaDevice' , function($cordovaDevice) {
             //add the $cordovadevice in the controller, then you can access device plugin.
    }]);


Step-2


angular.module('home.ctrl', [])
         .controller('homeCtrl' , ['$cordovaDevice' , function($cordovaDevice) {
        var device = $cordovaDevice.getDevice();
        var device = $cordovaDevice.getCordova();
        var device = $cordovaDevice.getModal();
        var device = $cordovaDevice.getPlatform();
        var device = $cordovaDevice.getUUID();
        var device = $cordovaDevice.getVersion();
    }]); 




Post a Comment

0 Comments