b8ne / react-native-pusher-push-notifications

Manage pusher interest subscriptions and notification events in Javascript.
MIT License
96 stars 85 forks source link

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.b8ne.RNPusherPushNotifications.PusherWrapper.setUserId(java.lang.String, java.lang.String, com.facebook.react.bridge.Callback, com.facebook.react.bridge.Callback)' on a null object reference #79

Closed smith-chris closed 2 years ago

smith-chris commented 2 years ago

Hey, I'm receiving this error upon calling Pusher.setUserId Here's full stacktrace:

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.b8ne.RNPusherPushNotifications.PusherWrapper.setUserId(java.lang.String, java.lang.String, com.facebook.react.bridge.Callback, com.facebook.react.bridge.Callback)' on a null object reference
at com.b8ne.RNPusherPushNotifications.RNPusherPushNotificationsModule$7.run(RNPusherPushNotificationsModule.java:107)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)

Quick SO search tells me but seems like the class hasn't been initialised properly. I'd appreciate if someone knowledgable around the codebase could help :)

smith-chris commented 2 years ago

Okay, resolved it. Pusher.setInstanceId has to be called before Pusher.setUserId. Closing