From e1968d0b2f87d95ed6481826b7dde250e0104019 Mon Sep 17 00:00:00 2001 From: John Weidner Date: Fri, 27 Mar 2026 16:53:49 -0500 Subject: [PATCH] fix: request historical data access from Health Connect Call requestHealthDataHistoryAuthorization() on Android after initial permission grant. Without this runtime request, Health Connect limits data access to the last 30 days regardless of the manifest permission. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/providers/health_sync.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/providers/health_sync.dart b/lib/providers/health_sync.dart index 0ac784b55..1198ff54c 100644 --- a/lib/providers/health_sync.dart +++ b/lib/providers/health_sync.dart @@ -108,6 +108,11 @@ class HealthSyncNotifier extends _$HealthSyncNotifier { return 0; } + // Request access to historical data (older than 30 days) on Android + if (Platform.isAndroid) { + await _health.requestHealthDataHistoryAuthorization(); + } + await PreferenceHelper.instance.setHealthSyncEnabled(true); state = state.copyWith(isEnabled: true);