Conversation
|
Looks ok to me. Some questions:
|
|
We should not remove that because it's required for the Application Opened event. For Android React Native, the bridge doesn't create the underlying native wrapper in time for the Application Opened event to correctly fire, therefore we have to duplicate that. For all other events, the bridge has created the analytics object and the events fire. The tests for the events are in the Android repo. This just sets the boolean on the builder. |
|
So just to confirm - there are 4 application lifecycle events that may be automatically collected:
Can you clarify, that after this change, which will handled in the RN wrapper, and which by the underlying Android library? w.r.t testing - it'd be great to understand some of the scenarios this was tested against end to end. |
|
Only Application Opened for React Native will be handled by the wrapper. And that is not with this change, nothing changes with this PR as that was already merged in the prior PR. |
|
I think I might be missing something here, aren't Application Installed, Application Opened and Application Updated handled in the RN wrapper (which is what we did for https://github.com/segmentio/analytics-react-native/pull/73/files)? |
|
You are correct. We are doing the backgrounded and opened (foregrounded) events in the Android library as to capture them both for RN and Native. |
|
Got it - so someone using the React Native library would see the Application Installed events twice (once from the RN wrapper, and once from the Android library)? |
|
No, because we used |
|
Insofar as testing and verifying events, I created both a native Android and React Native app and linked the local RN and Android analytics libraries. Created a segment account and used the debugger to see events. |
|
Ah got it - I didn't realize the same preferences were being used by both libraries. Since there isn't any explicit synchronization, this does feel a bit racy (as we can't guarantee which order the code will run in), but it feels unlikely this will be a problem in practice given how the RN <> native bridging works. Thanks for describing the test case - that's exactly what I was looking for! |
|
cc @bsneed @danieljackins for reference |

Previously the track application call was set on the builder after it was passed to the build with integrations call. We want to call it before ensuring the boolean is set when the builder creates the Analytics singleton.