This document explains how to use Location Tracking using methods provided by the Maps external object.
In order to create an application that keeps track of a device's position, it is possible to define a Panel object with three events (buttons):
The first button starts the tracking:
Event 'StartTracking'
Composite
Maps.ClearLocationHistory()
Maps.StartTracking(60,100,"",0)
msg("Start")
EndComposite
EndEvent
Read about the StartTracking method.
The second button stops the tracking:
Event 'StopTracking'
Composite
Maps.EndTracking()
msg("Stop")
EndComposite
EndEvent
Read about the EndTracking method.
At the end, the GeoPoints can be recovered using the GetLocationHistory method:
Event 'SetPositionsInMap'
&locationCollection = Maps.GetLocationHistory(&Today)
Endevent
and the loaded collection would be shown in a Grid with its Control Type property = Maps.
To download an example, click here: GeoLocationAPI Tracking.
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, if you want to do background tracking, it is necessary to include the 'location' value to the
Background Modes property.
Geolocation - Show points near me
Geolocation - Showing My Location
Geolocation external object
Tracking using Silent Notificaction