DataStore¶
public classDataStore
Persisted location record management — query, upload, and destroy stored locations.
Access via BGGeo.instance.store.
Members¶
all¶
Retrieve all LocationEvent records stored in the SDK's SQLite database.
let bgGeo = BGGeo.shared
Task {
do {
let locations = try await bgGeo.store.all()
print("[getLocations]", locations)
} catch {
print("Error: \(error)")
}
}
count¶
Retrieve the count of all locations currently stored in the SDK's SQLite database.
destroy¶
Remove a single location by LocationEvent.uuid.
destroyAll¶
Remove all records from the SDK's SQLite database.
let bgGeo = BGGeo.shared
Task {
do {
try await bgGeo.store.destroyAll()
} catch {
print("Error: \(error)")
}
}
sync¶
Manually upload all queued locations to HttpConfig.url.
Initiates a POST of all records in the SQLite database to your configured
HttpConfig.url. Records that receive a 200 OK response are
deleted from the database. If HttpConfig.batchSync is true, all
locations are sent in a single request; otherwise one request is made per
location. If no HTTP service is configured, all records are deleted from
the database.
See also
- HTTP Guide