Table of contents

Official Content

The purpose of this article is to explain the necessary steps to use Location Proximity Alerts to solve Geofencing with GeneXus.

The following methods are used to create an application to alert the user when moving within or beyond a defined distance from a geolocation.

Steps to set a new Alert

New alerts are created on the device. To do this, follow two steps:

1. Create an action (user-defined event executed on the client-side) in the Main object.
This event will be executed when the alert is triggered. For example:

Event 'ProxAlertNotification'
    // event code

2. Use the SetProximityAlerts method, and set up the following data:

  • Name
  • Description
  • Geolocation
  • Radius
  • Expiration Time
  • Action Name

The information must be loaded in a GeolocationProximityAlert SDT -&alert-, and added to a collection of the same type -&alerts- so that the method can receive it.

&alert.ActionName = 'ProxAlertNotification' 
&alert.Name = 'Test' 
&alert.ExpirationTime = #2015-12-31# 
&alert.GeoLocation = '-35,-56' 
&alert.Radius = 1000 

&boolean = Maps.SetProximityAlerts(&alerts)

This will trigger an alert that will execute the event 'ProxAlertNotification' when the user moves within or beyond 1000mts from the geolocation '-35,-56'.

Get the information of the current alert

Executing an event when the alert is triggered is optional. But if you do it, you must know which alert executed the event, in order to do something with that information.
This method must be used in the event executed by the alert to get the information on it.

&alert = Maps.GetCurrentProximityAlert()

Get the list of active alerts in the device

To get the list of active alerts on the device, you should use the GetProximityAlerts method.

&alerts = Maps.GetProximityAlerts()

Clear the Proximity Alerts set on the device

In order to delete all the alerts set on a device, you must execute the ClearProximityAlerts method as follows:



  • In order to use this feature on Apple devices, set the Location Always usage description.
  • In order to use this feature on Android devices, enable Use Proximity Alert property at Native Mobile Main object properties. The purpose of this property is to indicate that alerts must be recovered after a device reboot.


You can download the sample here: Geolocation Proximity Alerts Sample.

See Also

Geolocation external object
SetProximityAlerts method
GetCurrentProximityAlert method
GetProximityAlerts method
ClearProximityAlerts method
GeolocationProximityAlert Data Type

Last update: November 2023 | © GeneXus. All rights reserved. GeneXus Powered by Globant