LocationQuery¶
Constrains a BackgroundGeolocation.getLocations query by page size, starting offset, and sort order.
A locations read is a paging operation: fetch a bounded slice of the SDK's SQLite database so a large table can be drained incrementally rather than materialised all at once. Unlike SQLQuery (a time-window query over the log database), the vocabulary here is paging-first.
// Newest 500 records
const page = await BackgroundGeolocation.getLocations({
limit: 500,
order: SQLQueryOrder.Desc
});
// Drain the table one page at a time
const total = await BackgroundGeolocation.getCount();
for (let page = 0; page * 500 < total; page++) {
const records = await BackgroundGeolocation.getLocations({ limit: 500, page });
}
Members¶
limit¶
Maximum number of records to return.
Without a limit, every matching record is returned in a single call.
offset¶
Number of records to skip before returning results.
Combine with LocationQuery.limit for offset-based paging. An explicit offset takes precedence over LocationQuery.page.
order¶
order?:SQLQueryOrder;
Sort order for results: SQLQueryOrder.Asc (oldest first) or
SQLQueryOrder.Desc (newest first).
Defaults to PersistenceConfig.locationsOrderDirection.
page¶
Zero-indexed page number — a convenience over LocationQuery.offset.
Resolves to offset = page * limit, so page 0 is the first page. Requires
LocationQuery.limit; without one it has no effect.