How to get device id in Ionic 2 using TypeScript

I am trying to get the device id in ionic2 using typescript.

I installed a cord plug-in device

And my code ...

platform.ready().then(() => { console.log(device.cordova); } 

But that does not work.

When I run the application on the device, there is no log.

Please help me.

Thanks!

+5
source share
1 answer

It looks like this is in the Ionic 2 docs . What you need to do is import the Device class from ionic-native and call the uuid property of the Device object.

for instance

 import {Device} from 'ionic-native'; platform.ready().then(() => { console.log(Device.device.uuid); } 
+9
source

All Articles