Uid
Get unique identifiers: UUID, IMEI, IMSI, ICCID and MAC.
Repo: https://github.com/lionelhe/cordova-plugin-uid
Installation
- Install the Cordova and Ionic Native plugins:
$ ionic cordova plugin add cordova-plugin-uid $ npm install --save @ionic-native/uid@4
- Add this plugin to your app's module
Supported platforms
- Android
Usage
import { Uid } from '@ionic-native/uid';
import { AndroidPermissions } from '@ionic-native/android-permissions';
constructor(private uid: Uid, private androidPermissions: AndroidPermissions) { }
async getImei() {
const { hasPermission } = await this.androidPermissions.checkPermission(
this.androidPermissions.PERMISSION.READ_PHONE_STATE
);
if (!hasPermission) {
const result = await this.androidPermissions.requestPermission(
this.androidPermissions.PERMISSION.READ_PHONE_STATE
);
if (!result.hasPermission) {
throw new Error('Permissions required');
}
// ok, a user gave us permission, we can get him identifiers after restart app
return;
}
return this.uid.IMEI
}
Instance Members
UUID
Get the device Universally Unique Identifier (UUID).
IMEI
Get the device International Mobile Station Equipment Identity (IMEI).
IMSI
Get the device International mobile Subscriber Identity (IMSI).
ICCID
Get the sim Integrated Circuit Card Identifier (ICCID).
MAC
Get the Media Access Control address (MAC).