OneSignal-Unity-SDK
OneSignal-Unity-SDK copied to clipboard
[Bug]: NullReferenceException at OneSignalSDK.OneSignalAndroid.get_PushSubscriptionState on Android
What happened?
Some of our users with Android 13 get this error:
Non-fatal Exception: java.lang.Exception: NullReferenceException : Object reference not set to an instance of an object. at OneSignalSDK.OneSignalAndroid.get_PushSubscriptionState(OneSignalSDK.OneSignalAndroid)
Steps to reproduce?
Happens sometimes with Android 13 devices
What did you expect to happen?
no NullReferenceException.
Unity version
2021.3.24f1
OneSignal Unity SDK version
3.0.7
Platform
Android
Relevant log output
Non-fatal Exception: java.lang.Exception: NullReferenceException : Object reference not set to an instance of an object.
at OneSignalSDK.OneSignalAndroid.get_PushSubscriptionState(OneSignalSDK.OneSignalAndroid)
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Had same problem ! Now using 3.0.9 SDK and this code for Init and Prompt internal async void InitializeOneSignal() { Debug.Log("Starting One Signal Init !"); OneSignal.Default.Initialize(m_OneSignalAppId); var result = await OneSignal.Default.PromptForPushNotificationsWithUserResponse(); Debug.Log("Notifications_PermissionChanged - " + result); }
and its working :) also i am on Unity 2022.3.x if it helps :)