amplitude/Amplitude-TypeScript

[RN][Android] First track() call after reopening app takes long time and freeze UI

sbongiz opened this issue · 1 comments

Expected Behavior

When reopening the application, the track() method should not block the UI.

Current Behavior

On fresh installation everything works fine, when reopening the application, the first (and only first) call to the track() method take more than 10 seconds and freeze the UI.

From the DEBUG Log:

Amplitude Logger [Debug]: {
  "type": "invoke public method",
  "name": "track",
  "args": [
    "user_click_tp",
    {
     SOME_PROPERTIES
    }
  ],
  "stacktrace": [
    SOME_STACK
  ],
  "time": {
    "start": "2024-02-24T16:18:40.800Z",
    "end": "2024-02-24T16:18:52.814Z"
  },
  "states": {
    "before": {
      "config.apiKey": "SOME_API_KEY",
      "timeline.queue.length": 0
    },
    "after": {
      "config.apiKey": "SOME_API_KEY",
      "timeline.queue.length": 0
    }
  }
}

Possible Solution

When this problem emerges, in Android Studio log I can find this two lines that usually don't show up:

W/Amplitude: Google Play Services not available for advertising id
W/Amplitude: Google Play Services SDK not found for app set id!

Note that if I trigger the same event immediately afterwards, it works without problems and I use Google Play Services for other things in the application that works even after the reopening.

Environment

  • SDK Version: "@amplitude/analytics-react-native": "1.4.7",
  • Installation Method: NPM
  • RN Version: 0.70.6