OneSignal-Android-SDK icon indicating copy to clipboard operation
OneSignal-Android-SDK copied to clipboard

Why is that OneSignalId is empty sometimes?

Open ilhomsoliev opened this issue 1 year ago • 3 comments

How can we help?

Basically, OneSignalId is empty when I call OneSignal.User.onesignalId. This is what I see in logs from OneSignal: [DefaultDispatcher-worker-4] OperationRepo.enqueue(operation: {"name":"update-subscription","appId":"****,"onesignalId":"local-****","subscriptionId":"****","type":"PUSH","enabled":true,"address":"****","status":"SUBSCRIBED"}, flush: false)

Is that normal that OneSignalId starts with 'local'?

And also, when I search user with subscriptionId provided it is different user, because I have login in my app, and when user is changed I login user with different externalId but in this case it is changed, but OneSignal.User.onesignalId gives me empty string. And it stays the same.

(externalId is the user who logined in last)

What should I do?

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

ilhomsoliev avatar Feb 02 '24 04:02 ilhomsoliev

Hi @ilhomsoliev that is correct--if a onesignal_id starts with local- it is basically no onesignal ID / missing onesignal ID.

There are various reasons why the OneSignal Id could be in this state. Would you be able to send over the full logs form the device so we can pinpoint the issue?

Thanks!

jennantilla avatar Feb 02 '24 23:02 jennantilla

@jennantilla i also experienced this, and documented it here: https://github.com/OneSignal/OneSignal-Cordova-SDK/issues/973

EinfachHans avatar Feb 11 '24 15:02 EinfachHans

Hi @ilhomsoliev, in your case, I would recommend using OneSignal.getUser().addObserver to listen for onesignalId when it becomes available. Note that the IDs might not be updated immediately after you log in/out due to network delays. By using the observer, you can retrieve the most recent ID when it becomes available.

jinliu9508 avatar Feb 22 '24 20:02 jinliu9508

Closing due to no response.

jkasten2 avatar Mar 15 '24 23:03 jkasten2