You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Though this discussion has been brought up before in #144, #170, #532, and #541, there still seems to be no documented workaround or built-in solution for sending a device token from a React Native app. This is critical for syncing to certain destinations like customer.io.
I'll summarize the previously proposed solutions:
From #144 - use a middleware. However, this does not work for app lifecycle events
From #524 - use a plugin. However, there seemed to be issues with the context not existing
From #541 - use onContextLoaded within a plugin. This solution seems to work okay, but requires the client to manually re-set every property in the device object (no deepmerging is supported).
None of these solutions seem to work completely without major caveats.
Proposed Solution
It would be great to have an officially sanctioned/well-documented way to set the token in Segment using the analytics-react-native lib. It would be even better, of course, to have this be a part of the core library.
The text was updated successfully, but these errors were encountered:
Hi @tomrom-pomelo - thanks for reaching out! We have just released @segment/analytics-react-native-plugin-device-token. We decided against adding device token collection to core since Firebase Cloud Messaging is the standard dependency for Android device token generation and did not want to add another dependency to core for people who don't need it. This plugin also has the ability to collect the APNS value from iOS builds, but additional iOS setup is required there anyway. It's not the perfect solution, but one we think covers the most use cases without impacting users who don't need it. Help it helps!
Nice, thank you. We use expo's push notification service not FCM, so we'll likely just copy this plugin and replace it with calls to expo-notifications.
Summary
Though this discussion has been brought up before in #144, #170, #532, and #541, there still seems to be no documented workaround or built-in solution for sending a device token from a React Native app. This is critical for syncing to certain destinations like customer.io.
I'll summarize the previously proposed solutions:
None of these solutions seem to work completely without major caveats.
Proposed Solution
It would be great to have an officially sanctioned/well-documented way to set the token in Segment using the analytics-react-native lib. It would be even better, of course, to have this be a part of the core library.
The text was updated successfully, but these errors were encountered: