Device uuid is null on platform browser
See original GitHub issueBug Report
Device uuid is null on platform browser
Problem
By running ionic cordova run browser
device uuid is null as Device object is empty
What is expected to happen?
Device info should be there as it supports browser platform
What does actually happen?
Device object is empty when running the application on browser platform
Information
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
Command or Code
ionic cordova run browser
Environment, Platform, Device
Platform is browser using chromeVersion information
@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
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Ionic 4 native Device plugin returns device uuid null on ...
Sadly the device.uuid property is not supported on the browser platform. See the supported platforms here. So you might want to check the ......
Read more >Ionic 4 native Device plugin returns device uuid null on ...
By running ionic cordova run browser device uuid is null as Device object is empty on browser platform. Device info should be there...
Read more >Ionic 4 native Device plugin returns device uuid ... - Ionic Forum
By running ionic cordova run browser device uuid is null as Device object is empty on browser platform. Device info should be there...
Read more >plugin device returning empty object : r/ionic
No matter what I do or try I can't get info about the device. I'm using last version of ionic 4. Since all...
Read more >cordova-plugin-device
Get device information. ... device.cordova; device.model; device.platform; device.uuid; device.version; device. ... Android; Browser; iOS; Windows; OSX ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The browser platform does not have access to the devices UUID. This is why
null
is returned for the browser platform.There are alternatives that you can implement on your own for example
Fingerprint.js
. The goal ofFingerprint.js
is to use all of the features that the browser has access to create a unique identifier. They advertise a 99.5% identification accuracy. There is a drawback where a user can do something to make the identifier change.@janpio for some additional feedback to your question, if the browser had the access permission, the UUID would be most likely related with the OS or a hardware ID.
For example:
IOPlatformUUID
. If you have a Mac, you can test this withioreg -rd1 -c IOPlatformExpertDevice | grep IOPlatformUUID
MachineGuid
from the registry but can be edited with administrator permission.dbus
machine-id
, but can be changed with root access.For Electron, I have been looking at some npm modules that would use the information that I posted in the example above. Unfortunately, browser, just does not have the necessary permission to access this level of information of the OS for security reasons. Because of that, users must find alternatives solutions like
Fingerprint.js
or create their own UUID and store it somewhere like IndexDB.as iOS does not share the UUID which is generated by the plugin from instance to instance (lost after reinstall) i do fallback on a generated GUID which is then saved to localstorage.