Ionic 4 native Device plugin returns device uuid null on platform browser

By running ionic cordova run browser device uuid is null as Device object is empty on browser platform.

Device info should be there as it supports browser platform like

platform: browser
uuid: "someid"
etc.

Here’s my code

import { Device } from '@ionic-native/device/ngx';

constructor(private device: Device) { }

console.log('Device UUID is: ' + this.device.uuid);

Result: Device UUID is: null

I’m using @ionic-native/device": "^5.5.0

Please help me out how to resolve this problem. I have tested the code on android device. It’s working fine

1 Like

There is no UUID on the browser. That value does not exist on the browser.

see: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-device/#deviceuuid

What should be the work around If I want to use the uuid for every platform? Also I’m getting device object empty. According to documentation at-least it should give me the device.isVirtual and device.version. How can I get these if the object returned is empty? There must be some kind of issue with browser platform.

I would file an issue on the Ionic Native repo for that wrapper. Not sure if it is Ionic Native not reporting the data, or the plugin. Have you checked the plugin in repo?

For what it is worth, that data is also available via the user agent information. (Which is probably where the plugin gets it information from anyway);