Support Topics Documentation Slack YouTube Blog

Cannot read property 'uuid' of undefined


(Purusothaman Ramanujam) #1

When using the below Messaging code in Cordova/Ionic project, I get the error as sgiven.




 Backendless.Messaging.registerDevice(['774826264009'],null);

Code causing the issue is:

var data = {
                deviceToken: null, //This value will set in callback
                deviceId   : device.uuid, // THIS ONE
                os         : device.platform,
                osVersion  : device.version
            };

Errror:

Cannot read property 'uuid' of undefined

(Mark Piller) #2

Here’s where the error comes from:

https://github.com/Backendless/JS-SDK/blob/master/libs/backendless.js#L3195

I believe this plugin must be installed in order for the device registration code to work:
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-device/


(Purusothaman Ramanujam) #3

Thanks for response. This helps.

I have the device plugin installed via the Cordova CLI. I will check if I have to call the device registration inside the deviceready event to use the device object.

Thanks agian.