LocationObject
One position fix of the device, with when it was taken and whether a mock location supplied it.
Utilização
Request a current position
Este tipo é usado por location.current
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>;
}Declaração do tipo
export type LocationObject = Fix;Membros 3
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
coords | LocationCoords | Sim | — |
timestamp | number | Sim | Milliseconds since the epoch, when the fix was taken. |
mocked | boolean | Sim | The fix came from the iOS simulator or an Android mock-location app. |
coords — campos aninhados
coords campos
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
latitude | number | Sim | — |
longitude | number | Sim | — |
altitude | number | Sim | Above sea level (iOS), or the WGS 84 ellipsoid (Android). |
accuracy | number | Sim | The radius of 68% confidence around the position. |
altitudeAccuracy | number | Sim | — |
heading | number | Sim | Degrees clockwise from true north that the device is moving. |
speed | number | Sim | Meters per second. |
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.