Closed youcefswoo closed 2 months ago
Hi, the short answer is that on both platforms we require you to write native code to handle push opens because notification opens are handled very differently by platform. That is why we link to our native SDKs' documentation. For Android that will mean handling an intent from the main activity. I will work on an example app update for the android side to demonstrate, but wanted to answer you sooner than later.
@evan-masseau I implemented it as shown in the screenshot, but when I tap the notification, the app crashes on Android.
@youcefswoo Hmm which version of the RN SDK? And I am guessing you're initializing from typescript code?
Can you see error output in logcat? This is probably a timing issue of invoking Klaviyo prior to initializing, going to have to think about how we can work around that.
@evan-masseau yes, I'm initializing the SDK on the React Native side. Do you still need the logs? Klaviyo SDK : 3.0.1 RN version : 0.73.3
@youcefswoo I can probably get started with this much detail. Thank you for all your contributions, I'll update as soon as I can!
@evan-masseau I switched the initialization of the SDK on the native side to make the tap on notifications work. So, it's not a bug, but I believe it would be beneficial for the SDK to offer a way to perform tracking on the React Native side as well.
This issue is stale due to inactivity. Please let us know if you are still encountering issues, otherwise this issue will automatically close in 10 days.
@evan-masseau I switched the initialization of the SDK on the native side to make the tap on notifications work. So, it's not a bug, but I believe it would be beneficial for the SDK to offer a way to perform tracking on the React Native side as well.
Fully agree, my first goal will be to enable the open tracking on Android without requiring you to also move your initialization logic. Tracking opens for both platforms from react native code is a harder lift, so I'm going to consider that a separate goal.
With our latest release, 0.4.2
, the timing issue related to tracking an opened push event and initializing Klaviyo SDK from react native code should now be resolved. We now hold that event in memory until Klaviyo gets initialized to work around this platform/timing limitation. Thanks for bearing with us, we'll continue to consider options for tracking this event from react native code, however as I mentioned before doing that in a cross-platform way is going to be tricky.
@evan-masseau I switched the initialization of the SDK on the native side to make the tap on notifications work. So, it's not a bug, but I believe it would be beneficial for the SDK to offer a way to perform tracking on the React Native side as well.
Fully agree, my first goal will be to enable the open tracking on Android without requiring you to also move your initialization logic. Tracking opens for both platforms from react native code is a harder lift, so I'm going to consider that a separate goal.
hi @evan-masseau , any news regarding offering open tracking capabilities on RN? I am currently working on an expo app and doing this from a managed expo isnt the most trivial i would say.
Checklist
Description
Proposed Solution
Alternatives Considered
No response
Additional Context
No response