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) <noreply@anthropic.com>
This commit is contained in:
John Weidner
2026-03-27 16:53:49 -05:00
parent a4d03bcc46
commit e1968d0b2f

View File

@@ -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);