Skip to content

fix(analytics): use Android ID and persist UUID fallbacks - #1624

Merged
monkeyWie merged 9 commits into
mainfrom
codex/fix-android-analytics-id
Oct 28, 2026
Merged

monkeyWie merged 9 commits into
mainfrom
codex/fix-android-analytics-id

Conversation

@monkeyWie

@monkeyWie monkeyWie commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Android analytics currently uses androidInfo.id (Android Build.ID), so installations running the same OS build can report the same GA client ID and be counted as one user.

Read Android's Settings.Secure.ANDROID_ID through the android_id plugin instead. All native platforms attempt their device ID API on every startup, even when a persisted fallback exists. If the API fails or returns an empty ID, reuse the stored fallback or generate and persist a UUID v4. A successful lookup leaves any fallback unchanged for future failures. API-derived IDs are never copied into the fallback config field.

Web uses the same backend config persistence for its UUID; browser localStorage is not used. Persist generated UUIDs in a dedicated extra.deviceId field. Ignore the legacy analyticsClientId key without migration, so historical build IDs cannot be reused as fallbacks. Existing Web/fallback identities start fresh when the new field is first populated. The analytics reporting protocol is unchanged.

Dependencies:

  • Add android_id ^0.5.2+1, compatible with the project's Flutter 3.41 / AGP 8 setup. android_id 0.6 requires Flutter 3.47.
  • Declare the already-locked uuid 4.6.0 package as a direct dependency; existing package versions are unchanged.

Validation:

  • 27 downloader config and settings controller tests passed, including regression checks that legacy IDs are ignored and the dedicated fallback field round-trips correctly.
  • Targeted Flutter analysis passed for all changed Dart files.
  • Android plugin Kotlin compilation passed: gradle :android_id:compileDebugKotlin --console=plain (AGP 8.11.1 / Kotlin 2.2.20 / JDK 17).
  • Chrome smoke checks verify Web reuses the backend config ID and returns a new UUID for backend persistence when absent; no analytics events were sent.
  • git diff --check passed.

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.33%. Comparing base (7d423e2) to head (e521106).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1624      +/-   ##
==========================================
+ Coverage   72.30%   72.33%   +0.02%     
==========================================
  Files         102      102              
  Lines       15683    15683              
==========================================
+ Hits        11340    11344       +4     
+ Misses       3109     3106       -3     
+ Partials     1234     1233       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@monkeyWie monkeyWie changed the title fix(analytics): use per-install IDs on Android fix(analytics): use Android ID and persist UUID fallbacks Oct 27, 2026
@monkeyWie monkeyWie added the bug Something isn't working label Oct 28, 2026
@monkeyWie
monkeyWie merged commit e0951de into main Oct 28, 2026
16 checks passed
@monkeyWie
monkeyWie deleted the codex/fix-android-analytics-id branch October 28, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant