Table of contents



Official Content

Warning: The Maps external object is newer than the Geolocation external object. Many of the methods and properties provided by both external objects are similar. The difference consists in the fact that the Maps external object uses the Geography data type while the Geolocation external object uses the Geolocation domain (which is deprecated). In addition, the Maps external object includes more functionalities. The use of the Maps external object and the Geography data type is highly recommended.

This API enables you to provide several Location Services on their Native Mobile Applications by interacting with the GPS on the device where the app is running.

The scenarios that this API resolves are described in the Geolocation API - Scenarios article. To enable the use of this API many methods have been defined as well as a Structured Data Type (SDT) object called GeoLocationInfo.

Clipboardexternalobject-Location_png GeolocationExternalObject

Properties

AuthorizationStatus

Returns the current authorization status. This can be useful when you are using an API that requires a higher authorization level than the one the user gave. You can warn the user and ask him to go to the settings and add the necessary permission if he currently has a minor permission (WhenInUse or Denied). This property is based on APIAuthorizationStatus domain. Note: This value is not available for Android apps.

Methods

Note: Those methods marked with an asterisk (*) only work on the device (not simulator nor web environment).

GetMyLocation method *

Warning: The GetLocation method of the Maps external object performs the same action as the GetMyLocation method of the Geolocation external object. The use of the Maps external object is highly recommended.

Returns the current location of the device.

Return value GeolocationInfo
Parameters minAccuracy:Numeric(8.0), timeout:Numeric(8.0), IncludeHeadingAndSpeed:Boolean [, ignoreErrors:Boolean ]

Authorized method *

Indicates whether the application has been given permission to use location services.

Return value Boolean
Parameters None

ServiceEnabled method *

Indicates whether location services are enabled in the device.

Return value Boolean
Parameters None

StartTracking method *

Starts generating tracking information. Check Tracking article.

Return value None
Parameters changeInterval:Numeric(8.0), distance:Numeric(8.0), action:Character(20), actionTimeInterval:Numeric(8.0) [, accuracy:Numeric(8.0) ]

EndTracking method *

Stops the generation of tracking information. Check Tracking article.

Return value None
Parameters None

GetLocationHistory method

Returns a collection of location information generated by the tracking methods. Check Tracking article.

Return value GeolocationInfo
Parameters startTime:DateTime

ClearLocationHistory method

Removes all previous location information generated by the tracking methods. Check Tracking article.

Return value None
Parameters None

GetLatitude method *

Returns the latitude of the given location.

Return value Numeric(9.5)
Parameters location:Geolocation

GetLongitude method *

Returns the longitude of the given location.

Return value Numeric(9.5)
Parameters location:Geolocation

GetDistance method

Returns the distance between the two locations given.

Return value GeolocationInfo
Parameters fromLocation:Geolocation, toLocation:Geolocation

GetAddress method

Returns a collection of addresses for the given location.

Return value Collection( Address )
Parameters location:Geolocation domain

In order to work properly, you must configure a valid Google API Key in Google API Key property at Environment level.

GetLocation method

Warning: The GeocodeAddress method of the Maps external object performs the same action as the GetLocation method of the Geolocation external object. The use of the Maps external object is highly recommended.

Returns a collection of locations for the given address.

Return value Collection( Geolocation )
Parameters address:Address

In order to work properly, you must configure a valid Google API Key in Google API Key property at Environment level.

SetProximityAlerts method *

Sets a set of proximity alerts and returns the success status of the operation. Check HowTo: Use Location Proximity Alerts article.

Return value Boolean
Parameters proximityAlerts: Collection(GeolocationProximityAlerts)

GetProximityAlerts method *

Get the list of proximity alerts set. Check HowTo: Use Location Proximity Alerts article.

Return value proximityAlerts: Collection( GeolocationProximityAlerts )
Parameters None

GetCurrentProximityAlert method *

Get the information of the current proximity alert. Check HowTo: Use Location Proximity Alerts article.

Return value GeolocationProximityAlerts
Parameters None

ClearProximityAlerts method *

Clear the list of proximity alerts set. Check HowTo: Use Location Proximity Alerts article.

Return value None
Parameters None

PickLocation Method

Picks (or select) a location.

Return value None
Parameters GeolocationPickerParameters:GeolocationPickerParameters

Events

It does not have any.

Domains

APIAuthorizationStatus domain

Detailed description in APIAuthorizationStatus domain.

Structured Data Types

GeolocationInfo

Detailed description in GeolocationInfo Data Type article.

GeolocationProximityAlert

Detailed description in GeolocationProximityAlert Data Type article.

GeolocationPickerParamters

Detailed in GeolocationPickerParameters Data Type article.

Notes

Scope

Generators: Apple, Android

Videos

Start Video Events in Mobile Applications

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant