Table of contents
Official Content

To create an application that keeps track of a device's position (the GPS must be activated), the following methods are provided by the Maps external object:

You can define, for example, a Panel object with three events (buttons) as follows:

The first button starts the tracking:

Event 'StartTracking'
        msg("Tracking Started")

The second button stops the tracking:

Event 'StopTracking'
        msg("Tracking Stoped")

The third button offers to recover the Location History using the GetLocationHistory method

Event 'SetPositionsInMap'
    &locationCollection = Maps.GetLocationHistory(&Today)

The loaded collection (&locationCollection) would be shown in a Grid with its Control Type property = Maps.

Note that the tracking system can be expensive in terms of battery, so the tracking operations should be started and ended based on the specific needs of the application.

Note: In Apple, to do background tracking, it is necessary to include the 'location' value in the Background Modes property.

Tracking - Silent Notifications

In the methods described above, the control and data registration are done exclusively from the device. The registration of the device's location may be interrupted by it, either because the user does not authorize the activation of the GPS, or the application on the cell phone stops running, etc.

In these cases, it may be useful to offer a tracking mechanism that is centralized from the delivery fleet provider, using notifications. The server sends a silent notification to wake up the device, which should reply with its current location.

You can find more information in: HowTo: Solve Tracking from a Silent Notification in Native Mobile apps.


Showcase - GeoCity: In this Knowledge Base, you can find the "MotoDriverApp" Panel that uses Tracking.

See Also

HowTo: Solve Geofencing with GeneXus
HowTo: Use GetLocation method from Maps external object

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