location.LocationTaskOptions
How a location task's updates run.
Verwendung
Register background updates
Dieser Typ wird verwendet von location.startUpdates
import { location, permissions, storage } from 'kuito';
// At module scope: a background launch runs the app's modules, not its UI.
location.defineUpdates('run', async ({ locations }) => {
const track: unknown[] = JSON.parse((await storage.get('track')) ?? '[]');
await storage.set('track', JSON.stringify([...track, ...locations.map((fix) => fix.coords)]));
});
async function startRun() {
const { status } = await permissions.request('locationAlways');
if (status === 'granted')
await location.startUpdates('run', {
accuracy: 'high',
distanceInterval: 10,
notification: { title: 'Recording your run' },
});
}Typdeklaration
export type LocationTaskOptions = WatchPositionOptions & {
/** iOS: let Core Location pause updates while the device stays put. Off by default. */
pausesUpdatesAutomatically?: boolean;
/** iOS: the blue status bar pill while the app locates in the background. Off by default. */
showsBackgroundLocationIndicator?: boolean;
/** Android: the foreground service's notification. Defaults to the app's name. */
notification?: { title?: string; body?: string };
};Mitglieder 6
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
accuracy | Accuracy | Nein | — |
timeInterval | number | Nein | Milliseconds between updates, at least. Android only; iOS delivers as fixes come. |
distanceInterval | number | Nein | Meters the device moves before the next update. |
pausesUpdatesAutomatically | boolean | Nein | iOS: let Core Location pause updates while the device stays put. Off by default. |
showsBackgroundLocationIndicator | boolean | Nein | iOS: the blue status bar pill while the app locates in the background. Off by default. |
notification | { title?: string; body?: string;} | Nein | Android: the foreground service's notification. Defaults to the app's name. |
notification — verschachtelte Felder
notification Felder
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
title | string | Nein | — |
body | string | Nein | — |
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.