WIP - Start a new session on a new app install #1896
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WIP - whether or not to do this
Description
One Line Summary
REQUIRED - Very short description that summaries the changes in this PR.
Details
Background:
Each session has an
isValid
property that is read at the start of a potential new session. If this value read isfalse
, then a new session will start and its property is set totrue
. If this value read istrue
, that means we continue on this same previous session.At the end of the session, this property will be set to
false
.Problem:
On a brand new app install, we were defaulting this value to
true
, which means the logic to trigger a new session will not happen, since the SDK will believe it should continue from a previous session. However, this is the first time the app is opened after a new install.Solution:
By defaulting instead to
false
, we ensure that this first app open will start a new session. In addition, this will trigger aTRACK_SESSION_START
operation and ask the server torefresh_device_metadata
, updating country and IP for this user.Sending this request body:
This is in line with what the iOS SDK does on a new app install as well.
Motivation
The primary motivation is to send a request to update country and IP after creating a user on a new app install. Secondary motivation is starting off the very first session correctly.
Scope
Affects the very first session on a new app install.
Testing
Unit testing
None
Manual testing
Tested on Android emulator API 33
{"refresh_device_metadata":true, "deltas":{"session_count":1}}
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is