accurate_step_counter 2.0.0
accurate_step_counter: ^2.0.0 copied to clipboard
Production-grade step counter for Flutter Android. Uses native TYPE_STEP_COUNTER sensor via foreground service for accurate tracking in foreground, background, and terminated states. Includes SQLite l [...]
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
2.0.0 - 2026-02-28 #
๐ Major: Native Step Service + Smart Merge #
This release promotes the native TYPE_STEP_COUNTER foreground service as the primary detection strategy and adds the SmartMergeHelper utility for combining multiple step sources.
Added #
-
๐ SmartMergeHelper โ New utility class for combining multiple step count sources
SmartMergeHelper.mergeStepCounts()โ Returnsmax(sensor, healthConnect, server, currentDisplayed)with monotonic guaranteeSmartMergeHelper.mergeSensorAndHealth()โ Simplified merge for apps without server recovery- Based on proven production pattern from the Meltdown app
-
๐ก Native Step Service Status API
isNativeStepServiceRunning()โ Queries actual Android service state (not just Dart flag)isUsingNativeStepServiceโ Getter to check if native service mode is activeStepCounterService.isServiceRunning()โ Static Kotlin accessor for service state
Changed #
- ๐ฆ VERSION BUMP to 2.0.0 โ Reflects architectural shift to native step service as primary
- ๐ README completely rewritten โ Reflects TYPE_STEP_COUNTER architecture, SmartMergeHelper, and production API
- ๐ CHANGELOG trimmed โ Condensed historical entries for readability
- ๐งน pubspec.yaml cleaned โ Removed boilerplate comments, improved description
Fixed #
- ๐ง StepCounterService.kt โ Added missing
isRunningflag to track service lifecycle state
Removed #
- ๐๏ธ Stale Hive artifacts โ Removed
accurate_step_counter/step_records.hive(leftover from pre-v1.9.0 Hive migration) - ๐๏ธ
.DS_Storeโ Removed committed macOS metadata file
1.9.5 - 2026-02-22 #
Fixed #
- Background isolate
sqfliteinitialization error โ AddedDartPluginRegistrant.ensureInitialized()to isolate entry point
1.9.4 - 2026-02-22 #
Added #
- Terminated sync gap reconciliation with idempotent deterministic gap keys
- Single-flight terminated sync to prevent concurrent reprocessing
- Production example flow in example app
1.9.3 - 2026-02-03 #
Added #
- Automatic 30-day log retention policy
- Database write batching (3-second buffer)
- Background isolate for database operations (
StepRecordConfig.lowEndDevice()) - Stream emission throttling (max 10Hz)
1.9.2 - 2026-02-03 #
1.9.1 - 2026-01-28 #
Verified #
- ANR-safe architecture audit: all Kotlin I/O on
Dispatchers.IO, async SharedPreferences, background SQLite
1.9.0 - 2026-01-28 #
1.8.12 - 2026-01-28 #
Fixed #
- Crash-proof
deleteRecordsBefore()with null/open checks after cold start recovery
1.8.11 - 2026-01-28 #
Fixed #
- Hive box cold start ANR โ Added
_ensureBoxOpen()for automatic box recovery
1.8.10 - 2026-01-27 #
Fixed #
- Critical: Android 12 ANR โ Replaced
DateTime.now()with UTC in 50Hz sensor loop
1.8.9 - 2026-01-21 #
Fixed #
- Android 14+ foreground service type requirement
- Android 12+ background start restrictions
- Added
BODY_SENSORS_BACKGROUNDandHIGH_SAMPLING_RATE_SENSORSpermissions
1.8.8 - 2026-01-20 #
Fixed #
- Real-time step counting restored โ Removed sensor-level sliding window (moved to logging layer only)
1.8.7 - 2026-01-20 #
Fixed #
- Duplicate external step writes โ Added mutex lock + in-memory tracking
1.8.6 - 2026-01-19 #
Added #
- Sensor-level shake rejection (sliding window validation)
skipIfDuplicateparameter forwriteStepsToAggregated()hasDuplicateRecord()andhasOverlappingRecord()in StepRecordStore
1.8.3 - 2026-01-14 #
Fixed #
- Midnight boundary โ Yesterday's steps no longer appear in today's count
1.8.2 - 2026-01-13 #
Added #
StepLogsViewerdebug widget- Singleton foreground service enforcement
- Multi-day terminated step distribution
1.8.1 - 2026-01-12 #
Fixed #
- Threshold normalization for SensorsStepDetector
- Terminated state sync for foreground service mode
1.8.0 - 2026-01-11 #
Added #
- sensors_plus integration for foreground service mode
- 671 comprehensive tests
[1.7.x] - 2026-01-08 to 2026-01-09 #
Key changes across 1.7.0โ1.7.8 #
- Samsung TYPE_STEP_DETECTOR compatibility fix with accelerometer fallback
- OEM-compatible foreground service (MIUI, Samsung)
- Real-time EventChannel for foreground service
- Critical Android 11 terminated state step inflation fix
- Duplicate prevention for foreground service sync
- Race condition fixes for SharedPreferences
1.6.0 - 2025-12-20 #
Added #
- External step import via
writeStepsToAggregated() StepRecordSource.externalsource type