Ionic 4 | Get Unique Device ID & Other Uid’s of UUID, IMEI, IMSI, ICCID and MAC using Native & Cordova Plugins

A device may have a different type of ID’s stored in it which are of different type and have different significance. Each device has this type of ID’s but in unique and distinct values. These ID’s can be a Unique Device ID, IMEI Sim number, MAC Address, etc.

As a developer, we may need such ID’s to save user data distinctly or for other purposes. In this post, we will talk about Two Ionic Native plugins which are specialized to fetch some of the important ID from a user device.

Unique Device ID: This plugin produces a unique, cross-install, app-specific device id.

Uid: Get unique identifiers: UUID, IMEI, IMSI, ICCID and MAC.

Let’s start with a new Ionic 4 Application

Update Ionic CLI

Make sure you have the latest version on Ionic CLI installed (current is v5.0.0)

Create a new Ionic 4 Application

To demonstrate we will create a new Ionic 4 application with a blank template, but if you already having an application up and running just go for it.

As our application is ready, let’s install two plugins to fetch Ids from a real device.

Install Unique Device ID Native & Cordova Plugin

Unique Device ID native plugin helps to fetch a unique device ID for Android, iOS and Windows Phone 8 which will remain the same even if the application is uninstalled by the user.

For cordova, we used this package instead of this show in Ionic’s native plugin page due to some bugs.

Install Uid Native & Cordova Plugin

Uid plugin will allow getting details about ID’s related to UUID, IMEI, IMSI, ICCID and MAC

for this plugin, we need Android Permissions plugin to get READ_PHONE_STATE permission


Import plugins in App’s Module

To use these plugins globally we will import then add in imports array in the app.module.ts file as shown below

Get ID’s in Home Component

To use in a component like home which is created by default in a blank Ionic template, first import plugins then add them in the constructor.

Let’s add Unique Device ID, Uid and Android Permissions plugin in file

Get Unique Device ID

To get Unique Device ID just call a get() method of uniqueDeviceId service

Get UUID, IMEI, IMSI, ICCID, and MAC using Uid Service

To use this plugin service method we need to check if application having READ_PHONE_STATE permission by calling getPermission() method in constructor.

After that, we only need to call uid variables to get values like

The complete file after adding all methods will look like this

That’s it! so here we discuss two Ionic Native plugins to get some of the important ID’s in Ionic application.

Leave a Reply

4 Comment threads
3 Thread replies
Most reacted comment
Hottest comment thread
6 Comment authors
prashantPiyush AgarwalanRoswellDavidAle del Río Recent comment authors
newest oldest most voted
Notify of

is it possible to retrieve the IMEI without restarting the application?


I’m interested too


i have the same question


I have the same question that, is it possible to get IMEI without restarting an app?

Ale del Río
Ale del Río

This tutorial is amazing. Thank you very much!

Piyush Agarwal
Piyush Agarwal

Unable to find Mac Address as it is returning 02:00:00:00… value. Excluding the mac, everything is wotking fine…..could you please help?


is possible to get IMEI without restarting an application?