Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: NullReferenceException at OneSignalSDK.OneSignalAndroid.get_PushSubscriptionState on Android #618

Open
1 task done
oliverebert opened this issue Jun 9, 2023 · 1 comment

Comments

@oliverebert
Copy link

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

  • I agree to follow this project's Code of Conduct
@oliverebert oliverebert changed the title [Bug]: NullReferenceException at OneSignalSDK.OneSignalAndroid.get_PushSubscriptionState on Adroid [Bug]: NullReferenceException at OneSignalSDK.OneSignalAndroid.get_PushSubscriptionState on Android Jun 12, 2023
@G-r-i-n-c-h
Copy link

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants