Skip to content

geolocation

Type Aliases

Coordinates

type Coordinates: object;

Type declaration

NameTypeDescriptionDefined in
accuracynumberAccuracy level of the latitude and longitude coordinates in meters.
altitudenumber | nullThe altitude the user is at, if available.
altitudeAccuracynumber | nullAccuracy level of the altitude coordinate in meters, if available. Available on all iOS versions and on Android 8 and above.
headingnumber | nullThe heading the user is facing, if available.
latitudenumberLatitude in decimal degrees.
longitudenumberLongitude in decimal degrees.
speednumber | null-

PermissionStatus

type PermissionStatus: object;

Type declaration

NameTypeDescriptionDefined in
coarseLocationPermissionStatePermissions state for the coarseLoaction alias. On Android, it requests/checks ACCESS_COARSE_LOCATION. On Android 12+, users can choose between Approximate location (ACCESS_COARSE_LOCATION) and Precise location (ACCESS_FINE_LOCATION). On iOS, it will have the same value as the location alias.
locationPermissionStatePermission state for the location alias. On Android, it requests/checks both ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION permissions. On iOS, it requests/checks location permissions.

PermissionType

type PermissionType: "location" | "coarseLocation";

Position

type Position: object;

Type declaration

NameTypeDescriptionDefined in
coordsCoordinatesThe GPD coordinates along with the accuracy of the data.
timestampnumberCreation time for these coordinates.

PositionOptions

type PositionOptions: object;

Type declaration

NameTypeDescriptionDefined in
enableHighAccuracybooleanHigh accuracy mode (such as GPS, if available) Will be ignored on Android 12+ if users didn’t grant the ACCESS_FINE_LOCATION permission (coarseLocation permission).
maximumAgenumberThe maximum age in milliseconds of a possible cached position that is acceptable to return. Default: 0 Ignored on iOS
timeoutnumberThe maximum wait time in milliseconds for location updates. On Android the timeout gets ignored for getCurrentPosition. Ignored on iOS

Functions

checkPermissions()

function checkPermissions(): Promise<PermissionStatus>

Returns

Promise<PermissionStatus>


clearWatch()

function clearWatch(channelId): Promise<void>

Parameters

ParameterType
channelIdnumber

Returns

Promise<void>


getCurrentPosition()

function getCurrentPosition(options?): Promise<Position>

Parameters

ParameterType
options?PositionOptions

Returns

Promise<Position>


requestPermissions()

function requestPermissions(permissions): Promise<PermissionStatus>

Parameters

ParameterType
permissionsnull | PermissionType[]

Returns

Promise<PermissionStatus>


watchPosition()

function watchPosition(options, cb): Promise<number>

Parameters

ParameterType
optionsPositionOptions
cb(location, error?) => void

Returns

Promise<number>