FMX.LocationDemo Sample

From RAD Studio Code Examples
Jump to: navigation, search

This is a sample that describes how to use location data in mobile applications, using FireMonkey.

Location

You can find the FireMonkeyMobile LocationDemo sample project at:

  • Start | Programs | Embarcadero RAD Studio Rio | Samples and navigate to:
    • Object Pascal\Multi-Device Samples\Device Sensors and Services\LocationDemo
    • CPP\Multi-Device Samples\Device Sensors and Services\LocationDemo
  • Subversion Repository:
    • You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.

Description

This application allows the user to display their location on a map and save it for future use.

Note: This sample application requires Internet connection.

How to Use the Sample

  1. Navigate to one of the locations given above, and open:
    • Delphi: LocationDemoProject.dproj
    • C++: LocationDemoProject.cbproj
  2. Press F9 or choose Run > Run.

Files

The sample files are LocationDemoUnit, the main form that constitutes the user interface for the FireMonkeyMobile LocationDemo Sample application and LocationDemoProject, the project itself.

Classes

FireMonkey TabSlideTransition represents the main window of the sample. It contains the following components:

Implementation

  • Make sure that the Switch is On and the iOS device has the Location Services On.
  • The sample shows the Latitude and Longitude for the location of the device using the TLocationCoord2D properties and the OnLocationChanged event.
  • TWebBrowser is used to show a map using Google Maps.

Uses

See Also

Samples