Skip to content

How to send device token from a React Native app #762

@tomrom-pomelo

Description

@tomrom-pomelo

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:

  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions