1

I am working on Geo fence with Google map. My question is about the minimum radius for CLCircularRegion. As I want to work with the region for 30 meters. But the functionality works for the 100 meters. I have searched a lot and found that Apple needs minimum radius 100 to create a region, no matter I have set 30 meters or 50 meters.

Here is the link - Geofencing iOS 6

Moreover, didEnterRegion call at 100 meters and didExitRegion works very oddly and took much time. I have also read, that it depends upon tower cells etc according to that these methods call.

Here is the link - What is the maximum and minimum radius that can be set for regions in iOS geofencing.

I want to know if I have set the region for 50 meters. Why it is not working as per required region radius. In fact, I observe that it is working for the radius 100 meters.

Here is the code:

 func createRegion(lat : CLLocationDegrees,lng : CLLocationDegrees) -> CLCircularRegion?
    {
        let latitude = lat 
        let longitude = lng 
        var radius = CLLocationDistance(50)

        if radius > locationManager.maximumRegionMonitoringDistance
        {
            radius = locationManager.maximumRegionMonitoringDistance
        }

        let region = CLCircularRegion(center: CLLocationCoordinate2DMake(latitude, longitude), radius: radius, identifier: "TEST")

        region.notifyOnEntry = true
        region.notifyOnExit = true

        return region
    }

Or also can anyone refer a good app that has Geo fence functionality. So that I can compare my app's accuracy with it.

Question: I have selected 50 meters radius and 'upon exit' notification should come. But I am getting a notification on/around 250 meters and some time more than this. Please help me out

Thanks!

Amanpreet
  • 1,301
  • 3
  • 12
  • 29
  • What is your question? Just requesting more information is not a question we can help you with. Do you have a specific programming problem? – kevin May 07 '18 at 13:31
  • @kevin - Yes, I have mentioned at the very first line, I want to know about the minimum radius for CLCircular region. – Amanpreet May 07 '18 at 13:36
  • What do you want to know about it? There is no "minimum radius", but the device does add some constraints about when to notify a user, so if you are running into issues you should share the relevant code and ask a question, or [read through the guidelines](https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/LocationAwarenessPG/RegionMonitoring/RegionMonitoring.html#//apple_ref/doc/uid/TP40009497-CH9-SW11) and point to something you don't understand. Just requesting information on a subject does not fit SO as it's hard to give answers to those types of questions. – kevin May 07 '18 at 13:52
  • @kevin, Agree I have read Apple said there is no minimum radius. But I have set radius 50 and didEnterInRegion called when I was 100 meter far from the location. I don't understand why? If there is no minimum radius then whats the issue, why it is not working for the radius 50 meters. Please let me know what else you want in the coding to understand my question. – Amanpreet May 07 '18 at 14:09

2 Answers2

3

Take a look at Apple`s developer documentation:

Article Apple

Official Documentation

When testing your region monitoring code in iOS Simulator or on a device, realize that region events may not happen immediately after a region boundary is crossed. To prevent spurious notifications, iOS doesn’t deliver region notifications until certain threshold conditions are met. Specifically, the user’s location must cross the region boundary, move away from the boundary by a minimum distance, and remain at that minimum distance for at least 20 seconds before the notifications are reported.

The specific threshold distances are determined by the hardware and the location technologies that are currently available. For example, if Wi-Fi is disabled, region monitoring is significantly less accurate. However, for testing purposes, you can assume that the minimum distance is approximately 200 meters.

And remind that if the Wi-Fi is disabled, then it will be less accurate.

Community
  • 1
  • 1
Emmanuel
  • 109
  • 1
  • 9
1

I think you can reverse engineer the minimum radius on your device by looking at the device logs in Console. For example, if I set a radius of less than 100m on my iPhone 8 with iOS 14.7, I get the following log statement:

Fence:Start Started monitoring fence myapp/<private> (<<private>,<private>>, radius 100.000, active tech <private>)...

So, 100m seems to be the minimum in my case.