flutter-segment icon indicating copy to clipboard operation
flutter-segment copied to clipboard

Update push token after the initial setContext

Open lironzemingo opened this issue 2 years ago • 0 comments

Hi, I'm using Firebase messaging to get the device token and send it to Segment, using

await Segment.setContext({
  'device': {
    'token': yourTokenString
  },
});
await Segment.track(eventName: 'Application Opened');

the thing is, that Firebase has an 'onTokenRefresh' event, where the might be updated. in that case - how do I update the token? if I use the code above, and the only way the token is propagated is by calling Segment.track(eventName: 'Application Opened'); then that might mess up my events, won't it?

lironzemingo avatar Sep 05 '23 08:09 lironzemingo