Most Android and iOS devices either include a GPS antenna, the ability to triangulate off cellular or wireless access points, or some combination. Accessing the location is different when using the platform APIs for iOS and Android. Luckily Delphi XE5 includes the TLocationSensor component. When activated it has a OnLocationChanged event which fired when the location changes more than the specified distance. In there simply examine the NewLocation.Latitude and NewLocation.Longitude to know the current location.
Learn more about multi-device, true-native app development with Delphi XE5 and check out other Mobile Code Snippets.
4 replies on “Mobile Location on iOS and Android”
How to set up iOS Simulator on Windows?
@donmutti There is a video on the Welcome page of Delphi under Start Here for iOS that outlines how you can get a free trial of MacInCloud. That is the only way to get an iOS Simulator if you are on Windows. It works really well though, and will have you going in just minutes.
In that video the iOS simulator was running on my Mac OS X host and Windows was running in a VM, so it just looks like the simulator was running in Windows.
@Jim McKeeth, thank you, I’ll keep going with MacInCloud.
But is there an opposite way – to start the MacOS on a virtual machine under Windows host with Delphi onboard, and connect to it?
@donutti It is unsupported and not allowed by the license, but there was an article on LifeHacker about running OS X in Virtualbox. http://lifehacker.com/5938332/how-to-run-mac-os-x-on-any-windows-pc-using-virtualbox So try that at your own risk.