Marking your spot
There are three sensors on Delphi's Tool Palette and they deal with location, motion, and direction. Three sample apps that get installed with Delphi in the Object Pascal\Mobile Snippets
folder demonstrate their use: Location
, Accelerometer
, and OrientationSensor
, respectively. The one we're interested in for this chapter is the first one.
If you look over this simple app, TLocationSensor
is the key to recording our geographical coordinates. Run it to get a sense of how it works, and you'll notice that no location information is gathered until the component is made active. Furthermore, after it's turned on, there's a bit of delay while it gathers location details to calculate its exact position.
Drop a TLocationSensor
component onto the main form of our park app and on tabParkEdit
, add a button that will be used to record our current location.
When viewing the list of parks on the tabParkList
tab, we don't need location services...