How do I handle silent mobile disconnects?
Silent disconnects mainly affect mobile-based integrations like Apple Health and Health Connect.
Silent disconnects mainly affect mobile-based integrations like Apple Health and Health Connect.
On app launch, call getUserId(). If it returns null when you expect a connection (for example on a new device or after an update), call initConnection() to re-establish it rather than disconnecting first. Duplicate initConnection calls are safe, so you can re-establish without forcing a disconnect/reconnect cycle.
The permission popup will not reappear because the original grant is remembered, unless you request expanded permissions or the app was deleted and reinstalled.
On reinstall:
If the device ID is unchanged, you keep the same user.
If the device ID changes, iOS treats it as a new device and a new user ID is created.
Enforce one provider connection per reference_id to avoid orphaned or duplicate user IDs.
For web-based integrations you normally receive a deauth event when access is revoked; in rare silent cases data requests return an AuthorizationExpired error. If getUserId returns null on the same device that was previously connected, capture a reproducible case for investigation.
A 404 from a data endpoint after webhooks means the user has deauthenticated and the connection is gone: handle it as "no longer connected", stop retrying, and return 2xx.
Last updated
Was this helpful?