> For the complete documentation index, see [llms.txt](https://docs.tryterra.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tryterra.co/faq/help-topics/data-api-sdk/mobile-sdk-setup-permissions-and-crashes/health-connect-background-sync-not-firing.md).

# Why isn't Health Connect background sync firing?

Health Connect background sync behaves differently from Apple Health, so `schedulerOn=true` working immediately is not expected on first connection.

How the scheduler works:

* It is a one-time task, re-enqueued on each `initTerra()` call, with an **8-hour gate per data type**.
* On first connection it only marks a timestamp and exits without fetching. The first real auto-sync therefore fires on the next foreground open **at least 8 hours after connecting**.
* Manual `getActivity` bypasses the gate, which is why it works straight away.

Also **set both your app and the Health Connect app to Unrestricted battery usage**, since Samsung Device Care silently kills background tasks placed in sleeping apps.
