Product Benefits Pricing Guides Docs About Contact us Try it out
Engagement

Amplitude Kotlin Stale Session ID Opt-In Tracking

Amplitude Android Kotlin SDK 1.35 fixes stale session IDs after opt-in. Track session ID validity to keep session counts and durations accurate.

· 3 min read

Session metrics are only as good as the session IDs behind them. If a user opts out, comes back and opts in again, and the SDK reuses an old session ID, one visit can look like a session that lasted days. Average session length, sessions per user and retention curves all get distorted without any error being raised.

Amplitude Android Kotlin SDK 1.35.0 (16 October 2026) fixes stale session IDs carrying over when a user opts back in on cold start, by validating saved sessions. The next release, 1.36.0 (21 October 2026), adds shared identity properties with an atomic setter, so several SDK instances can share and sync user identity. It also fixes selectable Jetpack Compose controls such as Checkbox and Switch being missed by autocapture.

Why This Matters

Consent changes are common in privacy-conscious apps. Every opt-in after a long gap is a chance for old state to leak into new data. The error is invisible in totals but obvious in the long tail of session durations.

Data Points to Track

  • sdk_version per session
  • session_id and session_start_timestamp
  • session_duration_seconds, including the 99th percentile
  • opt_in_state (opted in, opted out, returned from opt-out)
  • days_since_last_session at cold start
  • sessions_per_user_per_day
  • instance_name when you run more than one SDK instance
  • identity_sync_conflict when two instances disagree on user ID
  • checkbox_switch_interaction_count after upgrade

Setup Steps

  1. Pull the distribution of session durations and note how many exceed 24 hours.
  2. Upgrade the Kotlin SDK to 1.35.0 or later, and preferably 1.36.0.
  3. Send an opt_in_state property on session_start.
  4. Create a chart of session duration by days_since_last_session for users who opted back in.
  5. If you use several instances, move shared user identity to the new atomic setter and record the instance name.
  6. Re-test Compose screens to confirm switches and checkboxes now produce interaction events.
  7. Compare sessions per user before and after for two weeks.

Actionable Insights

Look at the longest sessions. A cluster of multi-day sessions among users who opted back in is the signature of the stale ID bug. After the fix, that tail should shrink.

Check whether retention changed. If old sessions were being merged into new ones, some users looked more active than they were. A small dip after the upgrade is a correction, not a regression.

Watch for identity conflicts between instances. A rising conflict count shows that two parts of your app disagree about who the user is.

Common Mistakes to Avoid

Do not backfill or edit historical sessions to hide the change. Annotate the release date on your charts instead.

Do not treat new switch and checkbox events as a surge in engagement. Part of the rise is better capture.