analytics-react-native icon indicating copy to clipboard operation
analytics-react-native copied to clipboard

createClient calling multiple times when app being killed status to foreground

Open ravi-tally opened this issue 2 years ago • 0 comments

  • analytics-react-native version:^2.16.1
  • React Native version:0.66.4
  • iOS or Android or both? both

Steps to reproduce

  • Initialise the segment as per provided document
const segmentClient = createClient({
      writeKey,
      trackAppLifecycleEvents: true,
      collectDeviceId: true,
      debug: true,
      trackDeepLinks: true,
    });
  • And I have checked the anonymousId something like : xyzpqr

segmentClient.userInfo.get()?.anonymousId

  • Now I have killed the app and open again at that time new anonymousId was created like : abcdefg

it means every lunch time this method call again and create a new anonymousId

While I have integrated older version 1.5.2 with SegmentAnalytics.useNativeConfiguration(); method, everytime I can get same anonymousId

Expected behavior

  • After upgrade to new version of segment ^2.16.1, it should be provide same anonymousId.

Is there any solution for this please share

ravi-tally avatar Oct 18 '23 13:10 ravi-tally