I'm developing an application where user can set multiple locations. I get succeed to show notifications when user get Enter or Leave specific location boundary.
Now, there is situation that i need to provide monitoring for all saved locations and it can be hundreds and more. I've read in Apple Forum and many where that iOS devices allow only 20 Region Monitoring.
I've develop my code to exceed this situation. I've set locationManager.distanceFilter = 200; and when i get update for location. Firstly, i've stop all Region Monitoring and by conditions for nearest locations and again start Region Monitoring for 20 saved locations.
I think above solution may cause for missing any saved location while stopping and again re-starting Region Monitoring. So, please provide me any other better solution to solve this only 20 notifications for Region Monitoring problem.
Have a nice day .!!..
Harvesine - Objective C
Harvensine - Swift
That will give you the distance between the two locations. After that you could compare that distance with the region radius to know if is inside the region.
Note: This distance will be in kilometers if your radius is on meters then just multiply the haversine method result with 1000 so that it's converted to meters.
This will allow you to always monitor the 20 nearest regions based on your location. Been able to monitor more than 20 since it will change the monitoring regions always to the 20 nearest regions.