FMX.LocationDemo Sample
This is a sample that describes how to use location data in mobile applications, using FireMonkey.
Contents
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
- Navigate to one of the locations given above, and open:
- Delphi: LocationDemoProject.dproj
- C++: LocationDemoProject.cbproj
- 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:
- A TLocationSensor
- A TWebBrowser
- A TListBox, named ListBox1, contains the following controls:
- A TListBoxGroupHeader
- Two TListBoxItems, named ListBoxItemLatitude and ListBoxItemLongitude
- A TListBoxGroupHeader named TListBoxGroupHeader2
- Ten TListBoxItems, named ListBoxItemAdminArea, ListBoxItemCountryCode, ListBoxItemCountryName, ListBoxItemFeatureName, ListBoxItemLocality, ListBoxItemPostalCode, ListBoxItemSubAdminArea, ListBoxItemSubLocality, ListBoxItemSubThoroughfare, ListBoxItemThoroughfare.
- A TListBoxHeader
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
- System.Sensors.Components.TLocationSensor
- FMX.WebBrowser.TWebBrowser
- FMX.ListBox.TListBox
- FMX.ListBox.TListBoxGroupHeader
- FMX.ListBox.TListBoxItem
- FMX.Layouts.TLayout
- FMX.Controls.TSwitch
- FMX.Controls.TLabel
See Also
- FireMonkey Application Design
- FireMonkey
- iOS Mobile Application Development
- Troubleshooting: Cannot Deploy to the iOS Simulator
- Troubleshooting: Cannot Deploy to the iOS Device
- Mobile Tutorial: Using Location Sensors (iOS and Android)
Samples
- VCL Sensors sample