location.defineUpdates
The task that gets the fixes of startUpdates(name), as a background task
(docs/background-tasks.md). Call it at module scope: a background launch
evaluates the app's modules without mounting its UI, and defining the task
is when updates started before the app was terminated resume.
Verwendung
Persist each batch of positions delivered to a background location task.
// Persist each batch of positions delivered to a background location task.
import { location, storage } from 'kuito';
location.defineUpdates('trip', async (run: location.LocationTaskRun) => {
await storage.set('latest-trip-batch', JSON.stringify(run.locations));
});
// Register at module scope. Declare background location and obtain permission
// before calling location.startUpdates('trip').Signaturen
(name: string, task: LocationTask): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
name | string | Ja | — |
task | LocationTask | Ja | — |
Rückgabe
void
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.