Codeunit Geolocation
Provides functionality for getting geographical location information from the client device.
Geolocation.SetHighAccuracy(true);
if Geolocation.RequestGeolocation() then
Geolocation.GetGeolocation(Latitude, Longitude);
Properties
| Name | Value |
|---|---|
| Access | Public |
| InherentEntitlements | X |
| InherentPermissions | X |
Methods
RequestGeolocation
Requests a geographical location from the client device and returns whether the request was succesful.
procedure RequestGeolocation(): Boolean
Returns
| Type | Description |
|---|---|
| Boolean |
True if the geographical location data was retrieved and is available, and the user agreed to share it, otherwise false. |
GetGeolocation
Gets a geographical location from the client device and returns it in the the longitude and latitude parameters.
procedure GetGeolocation(var Latitude: Decimal, var Longitude: Decimal)
Parameters
| Name | Type | Description |
|---|---|---|
| Latitude | Decimal |
The latitude value of the geographical location. |
| Longitude | Decimal |
The longitude value of the geographical location. |
IsAvailable
Checks whether geographical location data is available on the client device.
procedure IsAvailable(): Boolean
Returns
| Type | Description |
|---|---|
| Boolean |
True if the location is available; false otherwise. |
HasGeolocation
Checks whether geographical location data has been retrieved from the client device and is available.
procedure HasGeolocation(): Boolean
Returns
| Type | Description |
|---|---|
| Boolean |
True if geographical location data is retrieved and is available, otherwise false. |
GetGeolocationStatus
Gets the status of the geographical location data of the client device.
procedure GetGeolocationStatus(): Enum "Geolocation Status"
Returns
| Type | Description |
|---|---|
| Enum System.Device."Geolocation Status" |
The status of the geographical location data. |
SetHighAccuracy
Sets whether the geographical location data for the device should have the highest level of accuracy.
procedure SetHighAccuracy(Enable: Boolean)
Parameters
| Name | Type | Description |
|---|---|---|
| Enable | Boolean |
Instructs the device that the geographical location data for this request must have the highest level of accuracy. |
SetTimeout
Sets a timeout for the geographical location data request.
procedure SetTimeout(Timeout: Integer)
Parameters
| Name | Type | Description |
|---|---|---|
| Timeout | Integer |
The maximum length of time (milliseconds) that is allowed to pass to a location request. |
SetMaximumAge
Sets a maximum age for the geographical location data request.
procedure SetMaximumAge(Age: Integer)
Parameters
| Name | Type | Description |
|---|---|---|
| Age | Integer |
The maximum length of time (milliseconds) of cached geographical location data. |
GetHighAccuracy
Gets whether the device should have the highest level of accuracy for geographical location data.
procedure GetHighAccuracy(): Boolean
Returns
| Type | Description |
|---|---|
| Boolean |
Whether high accuracy is set. A value to provide a hint to the device that this request must have the best possible location accuracy. |
GetTimeout
Gets the timeout for the geographical location data request.
procedure GetTimeout(): Integer
Returns
| Type | Description |
|---|---|
| Integer |
The maximum length of time (milliseconds) that is allowed to pass to a location request. |
GetMaximumAge
Gets the maximum age for the geographical location data request.
procedure GetMaximumAge(): Integer
Returns
| Type | Description |
|---|---|
| Integer |
The maximum length of time (milliseconds) of geographical location data. |