OneSignal / OneSignal-Xamarin-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Xamarin app with OneSignal. https://onesignal.com
Other
105 stars 50 forks source link

[Bug]: OneSignal.Default.PushSubscriptionState.userId return null #343

Open ChoyWingLun opened 1 year ago

ChoyWingLun commented 1 year ago

What happened?

I am testing on my android phone and sometimes I found that OneSignal.Default.PushSubscriptionState.userId return null and I am not able to add tags to my subscription.

Steps to reproduce?

1. Using OneSignalSDK.Xamarin 4.1.3 and Xamarin Forms 5.0.0.2515

What did you expect to happen?

Return userId to me so that I can add my tag to the subscription.

OneSignal Xamarin SDK version

Release 4.1.3

Which platform(s) are affected?

Relevant log output

No response

Code of Conduct

jkasten2 commented 1 year ago

@ChoyWingLun PushSubscriptionState.userId might be null as the SDK may have not gotten the id yet. However you can use PushSubscriptionStateChanged to get this value when it becomes available.

If you still don't get the value you will need to check the Android logcat for any errors to find out the reason for why it didn't get an id.