For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

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

How the scheduler works:

  • Health Connect only lets your app read in the background if the user grants its separate background-read permission. The normal data permissions don't cover it.

  • From Android SDK 1.7.0, connecting with schedulerOn=true requests that permission during the connection flow and schedules the recurring sync once it is granted. Use 1.7.3 or later: before that, the sync could be scheduled without the permission and then couldn't read anything.

  • If the user declined, no background sync is scheduled. Call enableBackgroundDelivery to ask again, and isBackgroundDeliveryAvailable to check the current state. See Background Delivery setup.

  • A new connection runs one initial sync. Manual getters such as getActivity read straight away, but only while your app is in the foreground.

  • React Native and Flutter apps get the Android SDK through their package, so check which Android SDK version that package includes. enableBackgroundDelivery is only available in the native Android SDK.

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.

Last updated

Was this helpful?