WatchPositionOptions
Trades how often and how precisely a position watch reports against the battery it costs.
Utilisation
Request a current position
Ce type est utilisé par location.watch
import { Text, location, permissions } from 'kuito';
const { status } = await permissions.request('location');
if (status === 'granted') {
const here = await location.current({ accuracy: 'high' });
const [place] = await location.reverseGeocode(here.coords);
}
function Here() {
// Locates while Here is mounted; the fixes land in location.position.
location.watch({ distanceInterval: 20 });
return <Text>{`${location.position.value?.coords.latitude ?? '…'}`}</Text>;
}Déclaration du type
export type WatchPositionOptions = LocationOptions & {
/** Milliseconds between updates, at least. Android only; iOS delivers as fixes come. */
timeInterval?: number;
/** Meters the device moves before the next update. */
distanceInterval?: number;
};Membres 3
| Nom | Type | Requis | Description |
|---|---|---|---|
accuracy | Accuracy | Non | — |
timeInterval | number | Non | Milliseconds between updates, at least. Android only; iOS delivers as fixes come. |
distanceInterval | number | Non | Meters the device moves before the next update. |
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.