Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class HealthAnchor
- Object
- HealthAnchor
An opaque cursor marking how far through a data type’s change history
the app has read. Wraps HealthKit’s HKQueryAnchor and Health
Connect’s changes token.
You normally never touch this: HealthStore persists the anchor for
each subscription itself, which is what lets a subscription survive the
app being killed. It is exposed only so that an app syncing to its own
server can checkpoint the cursor alongside its upload watermark and
keep the two consistent.
Anchors expire. Health Connect change tokens are invalid after 30 days,
and an iOS anchor can be rejected after a restore from backup. When
that happens the next batch reports
HealthChangeBatch.isResyncRequired() and the app must fall back to a
full time-range read.
Methods
public static HealthAnchor of(String token) | Wraps a platform cursor. |
public static HealthAnchor fromStorableString(String stored) | Restores an anchor previously written out with toStorableString(). |
public String toStorableString() | A form of this anchor safe to persist in Storage, Preferences or your own database, and to pass back to fromStorableString(String) on a later launch. |
public boolean equals(Object o) | Indicates whether some other object is “equal to” this one. |
public int hashCode() | Returns a hash code value for the object. |
public String toString() | Returns a string representation of the object. |
Inherited methods
Method details
of
public static HealthAnchor of(String token)fromStorableString
public static HealthAnchor fromStorableString(String stored)toStorableString(). Returns null for null or empty input, which
callers should treat as “start from the beginning”.toStorableString
public String toStorableString()A form of this anchor safe to persist in Storage, Preferences
or your own database, and to pass back to
fromStorableString(String) on a later launch.
The contents are platform-specific and must not be parsed, compared for ordering, or sent to a different device.
equals
public boolean equals(Object o)hashCode
public int hashCode()toString
public String toString()