amplitude / amplitude/ampli-examples
New session ID is not created
- Lingua principale
- Java
- Stelle
- 12
- Fork
- 12
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
SDK version: 1.4.4
A new session ID is not provided even after the minTimeBetweenSessionsMillis is exceeded. The issue only happens when there is an ampli.identify() call at app start. In this case `startNewSessionIfNeeded` is called twice causing probably some threading issue. When I only put a breakpoint inside `isWithinMinTimeBetweenSessions` I get `timestamp - lastEventTime == 0`. If I start debugging I can also get a negative number for `timestamp - lastEventTime`

I can see that once the function is called from `onEnterForeground` and the other time it is called because of `applyContextData` inside `AndroidContextPlugin` because of the identify call. Probably this is causing a threading issue.
With this I can reproduce the issue:
```
ampli.load(
context,
LoadOptions(
environment = Ampli.Environment.DEVELOPMENT,
client = LoadClientOptions(instance = Amplitude(Configuration(apiKey = apiKey, context = context, minTimeBetweenSessionsMillis = 5000)))
)
)
ampli.identify(null, Identify(property ="value"))
```
Once the identify is removed then it works fine.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.