> 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/no-data/webhooks-background-delivery-stopping/samsung-background-battery-sync-loss.md).

# Why do Samsung users lose sync after the app sits idle?

On Samsung devices, both Health Connect and your app must stay alive in the background for sync to continue. Samsung's Device Care battery optimisation aggressively sleeps apps overnight, which silently stops sync.

**Have users adjust two battery settings** for both your app and Health Connect:

{% stepper %}
{% step %}
Set battery usage to **Unrestricted**.
{% endstep %}

{% step %}
Remove them from **Sleeping** and **Deep sleeping** apps.
{% endstep %}
{% endstepper %}

On the code side, call `initTerra()` each time the app returns to the foreground. This re-enqueues the one-time background sync worker if the process was killed. See the [Android SDK reference](https://docs.tryterra.co/reference/health-and-fitness-api/sdk-references/android-kotlin) for details.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tryterra.co/faq/help-topics/no-data/webhooks-background-delivery-stopping/samsung-background-battery-sync-loss.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
