How to Use UniqueDeviceId in ionic/react

369 Views Asked by At

i want to get Uniquedeviceid from device and then use it . i fount the solution for angular by in ionic/react i didn't find any suitable solution. the sample is like this at first i installed this :

$ ionic cordova plugin add cordova-plugin-uniquedeviceid
$ npm install --save @ionic-native/unique-device-id@4

then when i want to use like this i have an error.

constructor(private uniqueDeviceID: UniqueDeviceID) { }
this.uniqueDeviceID.get()
.then((uuid: any) => console.log(uuid))
.catch((error: any) => console.log(error));
1

There are 1 best solutions below

0
Riya Singh On

Actually you just need the core plugin cordova-plugin-device and you need to call the object device.uuid in order to get the unique device id