u/Own-Rough3783

▲ 5 r/flutterhelp+2 crossposts

How can WidgetKit display the latest HealthKit steps without opening the app?

I'm building a Flutter health app that tracks steps and sleep using HealthKit. I've also created WidgetKit widgets so users can view their latest step count and sleep data without opening the app.

On Android, I use WorkManager to update the widget approximately every 45 minutes, and that works well.

On iOS, however, once the app is terminated, background work is no longer reliable, so I can't periodically fetch HealthKit data and update the widget.

My main question is about live HealthKit data:

  • How do health apps keep their step-count widgets updated while the app has been terminated for days?
  • Can HKObserverQuery with HealthKit background delivery wake the app after it has been terminated, or does it stop working until the user launches the app again?
  • Is there an Apple-recommended architecture for keeping HealthKit widgets reasonably up to date?
  • Are BGTaskScheduler, WidgetKit timelines, or App Intents sufficient for this use case, or are there limitations that make truly live updates impossible?
  • If you've built a HealthKit-based widget before, how do you keep the widget displaying the latest step count without requiring the user to open the app?

I'm looking for Apple's recommended approach and any real-world implementation experience. Any advice or links to relevant documentation would be greatly appreciated.

reddit.com
u/Own-Rough3783 — 2 days ago