geoLocation module

Note

This namespace is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Module to interact with the geoLocation module-specific part of the SDK. This is the newer version of location module.

Interfaces

Location

Data struture to represent the location information

Functions

getCurrentLocation()

Fetches current user coordinates

hasPermission()

Checks whether or not location has user permission

isSupported()

Checks if geoLocation capability is supported by the host

requestPermission()

Requests user permission for location

Function Details

getCurrentLocation()

Note

This API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Fetches current user coordinates

function getCurrentLocation(): Promise<Location>

Returns

Promise<Location>

Promise that will resolve with Location object or reject with an error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error

hasPermission()

Note

This API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Checks whether or not location has user permission

function hasPermission(): Promise<boolean>

Returns

Promise<boolean>

Promise that will resolve with true if the user had granted the app permission to location information, or with false otherwise, In case of an error, promise will reject with the error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error

isSupported()

Note

This API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Checks if geoLocation capability is supported by the host

function isSupported(): boolean

Returns

boolean

boolean to represent whether geoLocation is supported

requestPermission()

Note

This API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Requests user permission for location

function requestPermission(): Promise<boolean>

Returns

Promise<boolean>

true if the user consented permission for location, false otherwise