How to solve "wl_deviceNoProvisioningRealm. null returned for key: userId" error?

479 views Asked by At

I'm using the command

WL.Client.getUserInfo("wl_deviceNoProvisioningRealm", "userId");

to get the deviceId of the user and send it with other informations with an adapter.

The problem is that every time I update the app, even giving it another version number, I start getting the error below every time the code is called

wl_deviceNoProvisioningRealm. null returned for key: userId

I can fix it if I call a WL.JSONStore.destroy inside wlCommonInit(), but of course I can't do it in a production environment.

The code to get deviceId is called twice, one of them is when I initialize the collections, inside "adapter..load..params".

Is that a way to fix it?

Thank you in advance.

1

There are 1 answers

0
felipeh On BEST ANSWER

I discovered my problem.

Actually, the method I was using to get deviceId uses a realm that lies in worklight server. So, I need to set connectOnStartup to true or call WL.Client.connect(). As my application need to work offline, I'm using the Apache Cordova device.uuid instead.