Search code examples
swiftgoogle-mapsgeolocationgeofencing

Geo fencing for iOS


I just wanted to enable only particular height-lighted country from entire google map to let the user select any location just like Android.

I referred so many link but the only shape I could monitor is circular not country shape.

I have a string of lat longs of whole country.


Solution

  • I referred so many link but the only shape I could monitor is circular not country shape.

    Unfortunately, iOS currently only lets you monitor circular regions, which means that you'll need to do some more work to monitor arbitrary-shaped regions. You'll want to do something like:

    1. Create a circular region that's tangent to the nearest border and start monitoring it.

    2. When you get a notification that the user has moved outside the region, check to see whether they've crossed the border. If not, remove the current region and go to step 1.