Open msageryd opened 8 years ago
I'm starting to think so too, we have a few of these crashes:
Attempt to invoke virtual method 'void com.mixpanel.android.mpmetrics.MixpanelAPI.identify(java.lang.String)' on a null object reference
And https://github.com/mixpanel/mixpanel-android/issues/385 it mentions this exception is thrown when the SDK hasn't been initialized so it seems plausible for a race-condition to occur in React Native apps using Mixpanel.
Any update on this? It seems reasonable to promisify the calls to the underlying mixpanel methods
+1
run into case when .reset()
made .track()
to not happen. Ended up with ugly setTimeout ;(
Have the same problem, as some calls which are ran on app start fail. Will resort to setTimeout for now, although I'm hoping for a promise-based one.
I'm also running into this issue. Starting to see:
Attempt to invoke virtual method 'void com.mixpanel.android.mpmetrics.MixpanelAPI.track(java.lang.String, org.json.JSONObject)' on a null object reference
Any updates on this?
Same here. Don't know if it's relevant but I see it mostly on older devices running older Android versions.
Any update on this? i am facing the same issue. Attempt to invoke virtual method 'void com.mixpanel.android.mpmetrics.MixpanelAPI.track(java.lang.String, org.json.JSONObject)' on a null object reference
I find this a bit odd.. No shadow at all over @davodesign84, instead kudus to you.
MixPanel is a commercial product. One would think that they'd support projects like this, as this seems to be the only way to use MixPanel on React Native. Did they miss that RN has grown kind of big? Anyway, I'm not using MixPanel anymore.
Thanks @msageryd . As you guys might know I don't have time to maintain the library and reached out again to Mixpanel team, let's see if they are interested helping out.
Everyone, I am in the middle of creating a PR that will have the initialize return a promise. Your app code will be responsible for not calling the track
methods until it has initialized, but that's not a major bummer.
The PR is at https://github.com/davodesign84/react-native-mixpanel/pull/123. You can use it today as it has a backwards compatible API
I suppose that the calls to Mixpanel are asynchronous. Is it safe to just call the functions and let them take care of themselves? Or are there any initializations that needs to be awaited on?
I'm thinking that
sharedInstanceWithToken()
might need to be awaited on to ensure everything is initialized before callingtrack()
etc.Are any of the functions blocking? It would be great to have some more knowledge of this.
Thank you for a great library.