Mobile Location on iOS and Android

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.

This entry was posted in Source Code. Bookmark the permalink.

4 Responses to Mobile Location on iOS and Android

  1. donmutti says:

    How to set up iOS Simulator on Windows?

  2. Jim McKeeth says:

    @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.

  3. donmutti says:

    @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?

  4. Jim McKeeth says:

    @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.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.